Friday, 13 April 2012

Runtime Exceptions: what is the true cost of reliance upon them?

Abstract

It is a common belief that the .Net framework provided System.Exception and its derived classes should be avoided when they are not absolutely essential, and that instead; meaningful, alternate, less expensive solutions should be sought out and applied. Expense in this instance refers to both the physical cost of resources (RAM, processing cycles, etc.) and the fiscal cost of maintaining and developing against code which utilises Exceptions.

Although there exist articles and publications which appear to recommend the use of Exceptions, this interpretation is misguided. Exceptions do have a run time cost, and they do have a development cost, this essay finds that avoidance of Exceptions is the preferred development technique, and that there are various industry standard Patterns for achieving this end.