What I learned from Jeff Richter [today] about exception handling

[I wrote this while at Devscovery]

When I FIRST learned about exceptions 3 years ago, I was told that exception handling was for handling exceptional situations. Jeffrey tells us that this is a myth and is just wrong. Exceptions are when a method cannot perform its expected behavior. There may be many reasons for this. There are plenty of exceptions to allow you to handle much of what comes along.

Of course, performance came into question since it more expensive to catch and exception than to test for it. A good example of this is looking at catching a DivedbyZeroException vs. testing for zero and not wasting the resources used by the exception. This is a matter of balance. If the possibility of a zero being passed in is a rarity, then the exception won’t be hit very often, yet an if statement would be hit 100% of the time.

Jeffrey is on a mission to get the word out on this because the myth has been alive for way too long. I realize that based on this myth, I do more error handling than exception handling in my code. Of course, this is especially important for component developers, who may not know how their components are being used down the road.

Of course, I learned a lot more than just this about exception handling. I won’t be able to look at my old code in the same way again and will probably end up going through and making some serious revisions.  

I have been at Devscovery for two days now and am learning so much. I am jumping around into different tracks and getting a fantastic smorgasbord of information. It would be nice to just have every session lined end to end and attend them all. Or just have them zap it all into our brains. Like any conference, picking and choosing is always hard. But having to constantly choose between deep internals with Richter, serious asp.net with Jeff Prosise, hard core debugging with John Robbins and the many other great topics and Wintellect presenters is really just a big pain in the butt.

Sara Faatz has done an amazing job of putting together a top-notch and intimate conference. Sara is also our marketing guru for INETA and her contributions there are beyond amazing.

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.