This is a mirror of official site: http://jasper-net.blogspot.com/

Can we get a little Unity?

| Tuesday, August 2, 2011
In this post I would like to do a simple introduction to Unity Application Block. Unity is a framework that supports dependency injection (DI) in constructors, properties, and method calls. Unity also supports intercepting method calls which I may cover in a later post.

The documentation for Unity is pretty detailed, so it is probably a good place to start for background information. I’ve also included a link to the download area in the references section at the bottom of the post.

What is Unity and why would you use it?

When you start a project, the code base is usually small so it is not difficult to maintain or test. As the project gets larger, it is often the case that it gets broken down into components, and each component is created separately, and then integrated into the rest of the project.

In the beginning, the components are self contained and testable on their own if the person doing the work was paying attention to object oriented design principles. Even if the component was carefully constructed, at some point during integration it is usually the case that component boundaries begin to break down and components start having strong dependencies on each other.

Part of the break down of component boundaries happens because components start to inherit responsibility for configuring the dependencies with other components. Once a component has built in knowledge on how to create and configure another component, it becomes difficult to separate the components and test them independently.

This is where Unity comes in. Not only does Unity take the responsibility for creating and configuring components, it does so in a consistent way. Components don’t have to know where their dependent components come from. In addition, Unity can automatically create the dependent components if, necessary, or use existing instances.

Read more: Greg's Cool [Insert Clever Name] of the Day
QR: can-we-get-little-unity.html

Posted via email from Jasper-net

0 comments: