PHP5 Exception handling
prev | next

Why Exceptions? - The Controversy

The exceptions concept has been discussed over and over again, some people argue that it has it's right to exist in the programming world, others think it's of no worth at all and makes everything more complicated. To me, this seems like one of the standard discussions, in the line of objectoriented vs procedural programming, c vs cxx or handcode vs case - there's place *for* everything, and there's always a bit of sense *in* everything.

The main problems seen with exceptions are:

Exception Handling is especially usefull when working with unknown libraries, devices or operations. An Author of a library might consider throwing Exceptions whenever an important Error occurs within his code and leave their handling to the user. Exceptions give you a superior alternative to simple return statements, in that they contain much more information about the location in the code where the Exception was thrown and enable you to have more control throughout the Error Handling process.
prev | next