|Home||Back to Index|
I’ve been looking into Microsoft’s Unity Application Block recently. Unity is an open source dependency injection (DI) container framework. I’ve looked at several others briefly in the past, mainly StructureMap, Spring.NET, and Ninject. After seeing a recent webcast from Microsoft Patterns & Practices on Introduction to Dependency Injection with Unity (nicely presented by Chris Tavares and Grigori Melnik), I was excited about this software. It’s both powerful and flexible, offering the developer multiple ways to configure and use the container (which can be both good and bad).
Here’s a key quote from Chris Tavares, the lead developer on the Unity project:
“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.”
Sounds great, doesn’t it? Unity will unite all these diverse projects.
But Microsoft’s Krzysztof Cwalina talked about the upcoming Managed Extensibility Framework (MEF) in his blog. In response to one of the comments, he wrote:
“We want to use it for extensibility of the Framework itself and Visual Studio. We cannot use Unity or Spring for this.”
I have great respect for Mr. Cwalina. I understand there are business and legal reasons behind Microsoft’s decision not to use open source in commercial products, even when that source is under the Microsoft Public License.
But it’s just stupid.
This is the same sort of wheel-reinvention that gave us MSBuild (an imperfect copy of NAnt) and Microsoft’s Unit Testing Framework (compare to NUnit). In this case, though, Microsoft’s reinventing their own code.
Update - February 1, 2009
Please see the Block on MEF post, which clears up some misunderstandings I had.