Welcome to DevAuthority.com Sign in | Join | Help

Exceptional rule of thumb

I can't remember where I initially saw it, but the best advice I've seen for when to use exceptions is as follows:

"Don't pee your pants in order to see if your fly is unzipped."

You should always check to see that you are in a valid state before proceeding rather than throwing a likely exception.

Published Wednesday, February 22, 2006 3:55 PM by jwooley

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Wednesday, February 22, 2006 11:31 AM by maplecreekhost

# re: Exceptional rule of thumb

Excellent analogy! Thanks for that. I will never see exceptions the same way again!
Wednesday, February 22, 2006 4:31 PM by Marko

# re: Exceptional rule of thumb

Brilliant!
Thursday, April 13, 2006 8:12 PM by jwooley

# http://blogs.ugidotnet.org/lbarbieri/archive/2006/02/23/35477.aspx

What do you think?

(required) 
required 
(required)