As I got involved in the .NET world, one of the things that bugged me (among lots of other things) was that classes didn't require you to specify or catch exceptions that it created. So even if I wanted to specify that my account class could throw an "AccountOverdrawn" error, I had no way of decorating the class to make it evident, nor had a way for users of my class to be aware or indeed even note that my class could throw it.

In my mind this is a limitation of .NET over Java. Someone then directed me to an interview by Anders Hejlsberg, the chief architect of C# (http://www.artima.com/intv/handcuffs.html). In it both he and Bruce Eckel agree that structured exception handling is not a good methodology, but the reasons they give left me wanting more.

The basic comments seem to be that programmers are lazy, and if you want to have a class that inherits from 10 different classes each with 8 structured exceptions they can throw, the lazy programmer is just going to write "catch (Exception e)" and be done with it. They do raise some interesting comments about extensibility and being able to modify base classes though.

I've seen some pretty bright minds on this list and am really interested in what you all think about exception handling. Is it a good thing or a bad thing to be able to force using classes to at least acknowledge exceptions?

Cory

_______________________________________________
Juglist mailing list
[EMAIL PROTECTED]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to