I've started to take a look at Dependency Injection Containers (IoC), mostly because we have started using them where I work and also just out of general interest and trying to get my mind around how they work.
Inversion of control, or IoC, is an abstract principle describing an aspect of some software architecture designs in which the flow of control of a system is inverted in comparison to procedural programming. In traditional programming the flow is controlled by a central piece of code. Using Inversion of Control this central control as a design principle is left behind. Although the caller will eventually get its answer, how and when is out of control of the caller. It is the callee who decides how and when to answer. The principle of Inversion of Control is also known as the Hollywood Principle. Inversion of Control as a design guideline serves the following purposes:
- There is a decoupling of the execution of a certain task from implementation.
- Every system can focus on what it is designed for.
- Every system does not make assumptions about what other systems do or should do.
- Replacing systems will have no side effect on other systems.
During my investigations I came across a lot of different .Net IoC frameworks, a lot of them had their own pros and cons, and a lot of people were hard core supporters of certain frameworks. Currently where I work we have chosen to go with Castle Windsor, although on this website I am currently playing aroung with Ninject.
Most of these frameworks have the same common concepts, but I would like to find out what your favourite IoC frameworks are. Below is a voting panel, so please choose your favourite framework and feel free to comment on why you chose yours.
UPDATE: The voting has closed and this is how the results finished up.
For some further reading on this topics, these are some of the links I came across whilst researching this topic:
http://en.wikipedia.org/wiki/Inversion_of_Control http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.aspx http://www.martinfowler.com/articles/injection.html http://blog.ashmind.com/index.php/2008/08/19/comparing-net-di-ioc-frameworks-part-1 http://blog.ashmind.com/index.php/2008/09/08/comparing-net-di-ioc-frameworks-part-2
Thank you for your votes!