Monday, April 28, 2008

Manejo de Excepciones? (No lo digo yo)

Pues bien, habiendo leido Exception Management Architecture Guide, solo me queda parafrasear lo siguiente (esto, de las páginas 8-9):

"You should only catch exceptions when you need to specifically perform any of the
following actions:

  • Gather information for logging
  • Add any relevant information to the exception
  • Execute cleanup code
  • Attempt to recover

If a particular method does not need to perform any of these actions, it should not
catch the exception..."

Ademas de...

"In other words, you should not use exceptions as a means to provide
your intended functionality."

y...

"Throwing exceptions is more expensive than simply returning a result to a caller. Therefore they should not be used to control the normal flow of execution through your code. In addition, excessive use of exceptions can create unreadable and unmanageable code."

En resumidas cuentas es decir, in spanish:
Usar los bloques de administracion de excepciones resultan costosos, ya que no solo incurren en aspectos de performance, el codigo pierde legilibilidad, dificultando su mantenimiento.
Se recomienda el uso de dichos bloques cuando se requiere realizar procesamientos adicicionales (rollbacks, limpieza de memoría, verificacion de estados, notificaciones, etc.)


De momento veo que actué como traductor, pero valió la pena (creo).

Saludos[at]Casa

No comments: