Sunday 9 October 2011

IOC - Inversion of Control

Currently, I'm using Inversion of Control (IOC) for most of my application building which I'm finding really useful and quite powerful. Some people consider IOC to be a pattern which follows the three R's: Register, Resolve and Release which is how you would use it by default. IOC usually takes some kind of container which holds all the mappings between objects, for example, if you wanted to use the class Chicken everytime you referenced the interface IAnimal then in you container you may have the following registration: _container.Register.To(); The syntax depends on which IOC library you are using; there are several. My current preferred choice of IOC library is Castle Windsor, which makes using IOC inside applications quite fun and simple.

No comments:

Post a Comment