Wednesday, June 4, 2008

More on the Unity Application Block

Microsoft has taken another stab at releasing a Dependency Injection container with the release of Unity. Unity 1.1 has been bundled into the Enterprise Library 4.0.

Unity is basically a slimmed-down version of ObjectBuilder without the support for interceptors.

Here's an interview with Chris Tavares, the lead developer of Unity.

RB: There are quite a few DI containers already, what was the motivation by your team in creating Unity?

CT: Patterns & practices has been giving guidance around dependency injection for a while now. CAB, Mobile client Software Factory, Smart Client Software Factory, Web Client Software Factory, and Enterprise Library have all used DI in various ways. That last word is the killer: “various”. Each project, although they were all build on ObjectBuilder, did DI differently and incompatibly. Having an explicit, fully featured container that we can use unencumbered allows us to provide better guidance around DI and container based architectures.

There are other reasons as well. We have customers that will not touch open source software for whatever reason. Having a DI container from Microsoft makes them feel safer and lets them get the advantages. It also puts them in a good position to later switch containers if they wish.

Another goal is to raise the profile of Dependency Injection both inside and outside of Microsoft. Having a container from Microsoft helps promote DI both to the general Microsoft .NET developer community and internal Microsoft developers as well.

Interceptors would be a good addition to Unity. This would allow deployment-time configuration of cross-cutting concerns, such as logging, performance monitoring, exception handling and security.

No comments: