Exception Handling

Chris Gray chris.gray@kiffer.be
Sat Jun 12 10:15:00 GMT 2004


On Saturday 12 June 2004 00:03, Andrew Haley wrote:
> [...]
> I don't know what the dynamic exceution ratio of try blocks to throw
> statements is, but I would guess at least 1000:1. There must be a
> study somewhere, but I can't find it.

I don't have any hard numbers either, but my experience leads me to believe 
that exceptions are thrown far more often than most VM/compiler developers 
would like to think. Sometimes Sun's APIs are to blame (by forcing the 
programmer to use try-catch rather than if-then-else), sometimes we would say 
the programmer is just lazy or ignorant. When I was working at Acunia the CTO 
berated the assembled developers for using too many exceptions, proclaiming 
that "exceptions should be exceptional" : so far as I could tell they ignored 
him completely.
Maybe someone who knows where to put the printf()s should try measring the 
try/catch ratio of some big lump of real-world code, e.g. Eclipse?
-- 
Chris Gray /k/ Embedded Java Solutions
Embedded & Mobile Java, OSGi http://www.kiffer.be/k/
chris.gray@kiffer.be +32 3 216 0369


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /