Monday, 26 August 2013

Under what circumstances is it feasible to use exception handling?

Under what circumstances is it feasible to use exception handling?

I have seen many exception handling mechanisms where they simply weren't
necessary. A lot of the times the problem could have been solved in a much
cleaner way using simple if statements.
For example, things like:
Invalid input
Division by zero
Wrong type
Container range check
Null pointer
Uninitialized data
... and so on.
Could someone provide an example where it would be a better approach to
handle exceptions?

No comments:

Post a Comment