Readify does apparently. We have a technical mailing list internally that most of the technical folk in the company are hooked up to. Chris Hewitt reflected on the fact that he usually tells people to throw exceptions when something exceptional happens – but that this advice didn’t necessarily jive with the advice from Microsoft.

The fact that I now have e-mails in my Inbox from people like Greg Low, Clarke Scott, Scott Baldwin, Rob Sanders, Rocky Heckman, Luke Drumm, Paul Glavich and Darren Neimke on the subject is probably some indication of passion generated by this seemingly simple subject.

Of course, nothing in software development is ever that simple and when you have the likes of Raymond Chen and Joel Spolsky weighing in on one side of the argument and the .NET Framework as a body of code serving as evidence for the other you can bet that this is something that we are going to be debating for a long time to come.

4 Responses to “Who cares whether you throw exceptions or return status codes?”


  1. Mitch,

    As you know, my team lives and breathes the Framework Design Guidelines, so I’m going to have to disagree with you here. What part of the Exception throwing section is in conflict with Chris Hewitt’s point?

    David

  2. Mitch Denny Says:

    Hi David,

    I don’t have Chris’ original e-mail message so I can’t tell you which bit he took issue with specifically. I was just pointing out that its a pretty tired debate. For the record, I like the runtime exception mechanism.

  3. MattyT Says:

    Prefer exceptions for error handling unless there is a good reason not to (performance being a potential exception to using exceptions).

    Any *good* advice to the contrary?

    Spolsky isn’t exactly known for his elegant coding BTW (though he’s obviously an excellent software project manager) and Chen, while generally a demi-God in software circles, is most at home with C. His issue with exception handling have predominately been along the lines of “it’s *really* hard – especially if you don’t consider exceptions with every line of code you write”, which is a common stance amongst C folks. Of course, you *have* to consider exceptions with every line of code – it’s a different mindset…

    Anyways, I prefer exceptions. For the simple reasons that it separates real code from error handling, it’s more structured (allowing errors to be handled at the logically correct location) and errors cannot be ignored.

    Cheers,

    Matt

  4. Mitch Denny Says:

    You won’t get any advice to the contrary from me. I love the way exceptions allow me to keep my code clean. I would advise that you keep your methods small so that the locality of the exception handling code is close to the code that could cause the error.


Leave a Reply