Inversion of Control
Inversion of control is a pattern where the creating and life time of the objects is passed from the client to another layer.
Reasons and scenarios to use this pattern
- If you want to remove the dependency on a implementation.
- To unit test each implementation without waiting for the dependent classes.
- To remove the repetitive code for creating, maintaining the objects.
There are two types of Inversion
- Dependency Injection
- Service locator pattern
There are many open source containers which have implemented these patterns few e.g. are Spring.Net, Unity Container of Microsoft etc.
These patterns should be used only for a medium to large type of applications as it would have large overheads.
More information @:
Leave a comment