2005.11.14

 

Exception handler count

by Karel Thönissen

I wrote earlier that we at Garabit make our software as brittle as possible. Our software will halt immediately when something is wrong and we do not try to rescue the situation with exception handling. The problem with exception handling is twofold. First, it hides the cause of the bug by moving control to another location, i.e. the exception handler. This reduces the possibilities of actually finding the root cause. Second, exception handlers are notorious bug hide-outs, because coverage testing for exception handling is extremely difficult, in particular in good code that contains very few bugs anyway.

Last week we had an inspection of our total code base. I do not want to tell the size of the entire code base, other than telling that it is really big. Now the interesting bit: we use no more than 0.24 exception handlers per thousand lines of code (or one per 4200 lines of code) and we do certainly not have a software quality problem.