Sam Smoot
6/19/2008 1:25:00 AM
Yes, the second example. Because not finding the record for a known
key is "exceptional".
*But* I'd like to say that this is a minority rule. Generally
speaking:
* Exceptions should *NOT* be used for flow-control
* Exceptions should be reserved for exceptional situations
People always rail against these, but they're always wrong. ;-) throw/
catch will give you most of the benefits, without the draw-backs.
Namely:
Exceptions are _orders of magnitude slower_ than normal flow-control
structures.
There's probably languages these guidelines don't apply to, but Ruby/
MRI isn't one of them. ;-)
-Sam