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.

Thursday, 27 August 2009

Inversion of Control (IoC)


What exactly does that mean?

At the heart of the matter IoC is all about loosely coupled software components.

Class1 has a member of type Class2 which is specified at design time.


Class1 has a member of type Interface1, and Class2 is an implementation of Interface1.


What is the difference between these two approaches as presented above?

The second example clearly involves more code? One might think then that in fact the first approach is better, or even that it is "cleaner"; it is quicker to write, it is simple to understand, and it results in fewer source files.

Wednesday, 26 August 2009


This blog entry is a response to an onerous blog entry which can be found here : andrewtroelsen.blogspot.com/decorator-pattern-extension-methods.html

The upshot is that the above blog entry wrongly states that you can implement the decorator pattern via .net extension methods, and further goes on to define an implementation which itself is not the decorator pattern.

Many people have commented on the original blog entry, however I don't think any of those comments goes far enough to properly explain why the original posting is wrong, or how it should actually be achieved.