Sunday, April 13, 2008

Dependency injection and MS Unity Application Block

Building flexible and maintainable application means to achieve decoupled or very loosely coupled design.
Loosely coupled application also mean that you can test them easily using mocks.
Two ways of achieving loosely coupled nature in an application is via techniques Dependency injection and service locator.
When we talk about dependency injection we are talking about plug-in based development and it's all about how to get a concrete implementation into your application without re-compiling your code..
You can read about dependency injection here, but this post is not about what dependency injection is but about frameworks that lets us do this in a productive manner.
Frameworks like Spring uses dependency injection techniques and there are other containers available.
What I am interested about is the container that Microsoft released last week, the Unity Application block.
This is a container that allows you use dependency injection in a productive manner in the .Net applications:

Unity tries to achieve the following vie dependency injection:
1) Provides simplified object creation.

2) Support of requirement abstraction, this allows you to specify dependencies at runtime or in a configuration file.

3) It increases flexibility by deferring component configuration to the container.
Unity is the new member to the MS pattern and practice, you can learn more about unity in it's official community site here...

No comments:

Post a Comment