Posted by: Rajesh Kanaparti | March 9, 2008

Loose Coupling, one of the mantras of good software design. How Unity can help ya?

As you might have already know the mantra “striving for loosely coupled designs between objects that interact ” , a very powerful one in software architecture. Why ? because loosely coupled applications are more flexible and easier to maintain. They are also easier to test during development.

In my mind its more important than ever because every one wants to customize or develop there own software on top of what the software vendor sells. Make sense because most business problems are different. This is where Inversion of Control also known as Dependency Injection comes to rescue to design loosely coupled objects. Although there are many containers( spring.net, PICO , Castle Project), as always Microsoft PNP( Patterns and Practices team) has done a good job in incorporating this component in there Application blocks .

The Unity Application Block (Unity) is a lightweight, extensible dependency injection container with support for constructor, property, and method call injection. It provides developers with the following advantages:

  • Simplified object creation, especially for hierarchical object structures and dependencies.
  • Abstraction of requirements that allows developers to specify dependencies at run-time or in configuration, and simplify management of crosscutting concerns.
  • A service location capability allows clients to store or cache the container. This is especially useful in ASP.NET Web applications where the developers can persist the container in the ASP.NET Session or Application.

You can get this block here. Also David Hayden made a screen cast on how to get started with this block. You can watch it here. Before jumping onto this screen cast it will be beneficial to read these posts written by David Hayden

For my next project, I am planning to use this container and I will blog about my experiences.Please check back later.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: