Sono senza parole... è una frase geniale!

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.

Fonte: Exceptional rule of thumb

posted on giovedì 23 febbraio 2006 15.27 | Filed Under [ .NET: varie ]

Comments

Gravatar
# re: Quando usare le eccezioni...
on 23/02/2006 16.37
bell'analogia ma se la portiamo sul lato tecnico puo` non essere esatta. In Python l'approccio EFGP (easier to get forgiveness than permission) e` comune, anche perche` l'eccezioni non sono cosi onerose come in linguaggi come Java. Certo ci vuole oculatezza come in tutto ma in linguaggi come Python a volte pisciarsi sui pantaloni e` la soluzione migliore per vedere se la zip e` aperta

saluti!
Gravatar
# re: Quando usare le eccezioni...
on 23/02/2006 16.46
:-D
Gravatar
# re: Quando usare le eccezioni...
Posted by nostromo
on 24/02/2006 15.19
frase bellissima la farà mia

Gravatar
# Quando usare le Interfaces...
Posted by PuntoRete
on 25/02/2006 4.43
Post Comment
Title *
Name *
Email
Url
Comment *  
Please add 8 and 4 and type the answer here: