Monday, August 15, 2005

Isn't checked Exceptions what we really want?

It has been decided to leave checked Exception out of the .Net framework.
The reason for doing this is that is that it should easier to change versions without recompiling. This to me sounds like late binding. I might as well go back to scripting.

I like checked exceptions because it forces you to design your code beforehand and ensures you that you have considered all error conditions.

More or less I want to keep track of less things in my head and let the compiler check my code for consistensy whereever it is possible.

Further more, when you talk about pluggable architecture, you want your plugins to follow certain rules. This is a perfect scenario where you really really benefit from checked exceptions.

Please put checked exception in .Net!


  1. This comment has been removed by a blog administrator.

  2. New version with fever spelling mistakes

    This is one of you’re old, favorite nags with .net ;)

    The way I see it you want a kind of verification that you handled all the possible exceptions that a function/object might throw at you. And that is OK with me.

    But why do you want the compiler to do that? Wouldn’t it be just as easy to include in FXCOP based on the inline documentation? This way you’d be able to change version without recompiling (seems like a good idea to me) and still be able to validate your come and the late fix the missing exception handling.

  3. Well... Why not?

    If I add new exceptions, the program will still be broken until I fix it. I don't want broken programs.

    It is not an option to document what exceptions you throw with checked exceptions. This is forced upon you. This means that you know what exceptions 3rd party modules throw before hand.

    On top of that it gives nice intellisense features.

    It's like saying: I don't like that the compiler checks if the methods I use actually exist.