Code Evasion

Gerard Holzmann recently published an article on “Code Evasion” in IEEE Software. He showed a couple of examples how error handling increases the complexity of reading and understand code, but also the increased potential for bugs. This does not mean to remove all error handling, but to give an extra thought.

In my opinion he is perfectly right. Writing proper error handling code is a big challenge. Ignoring it at all and let program crash is not always an option.

Using exceptions instead of return values can increase the readability. It does not mitigate the complexity of error handling and proper reactions. IMHO one of the advantages of exceptions – at least in programming languages like C++ and C# – is that they can bubble up and you can catch them some where very different. Probably at a place where you can react properly.