{ |one, step, back| }

Catch Curly Curly
19 Aug 03 - http://www.pairprogrammingbot.com/index.cgi/Tech/Programming/CatchCurlyCurly.rdoc
Java’s checked exceptions are the type of thing that sound good at first glance, but have seriousl drawbacks in productions use. I was pleasantly surprised when Bruce Eckel echoed many of my observations in his checked exceptions essay. More recently, Anders Hejlsberg (the designer of the C# language) has weighed in with his opinions of Java’s checked exceptions.

Here are some quotes from the article

The throws clause […] requires you to either catch declared exceptions or put them in your own throws clause. To work around this requirement, people […] decorate every method with, "throws Exception." That just completely defeats the feature, and you just made the programmer write more gobbledy gunk. […]

Yep, that’s me. I use throws Exception a lot.

Anders goes on to comment that the focus is not generally on handling exceptions, but making your code robust in the presence of thrown exceptions. And that generally means finally blocks. He observers that …

In a well-written application there’s a ratio of ten to one, in my opinion, of try finally to try catch.

Interesting. I wonder how much duplication occurs in all those finally blocks. That’s why I like Ruby’s ability to abstract the finally (ensure in Ruby) to one location.

Finally, here’s where I got the title for this blog entry.

I can’t tell you how many times I’ve seen this — they say, "try, da da da da da, catch curly curly." They think, "Oh I’ll come back and deal with these empty catch clauses later," and then of course they never do.

I"m not guilty of the catch curly curly syndrome, but I’m not surprised that its a common problem. Bruce Eckel says it best when he calls Java’s checked exceptions a failed experiment.