InfoQ

News

Microsoft Embraces Dependency Injection in the Framework

Posted by Jonathan Allen on Apr 28, 2008 06:55 AM

Community
.NET
Topics
Agile Techniques
Tags
Dependency Injection

In order to reduce duplication across frameworks like WCF, WPF, and ASP.NET, Microsoft has formed the Application Framework Core team. The goal of this team is to prevent design issues like the different dependency property systems for WPF and WF.

One of their first projects is the Managed Extensibility Framework or MEF. This project will leverage techniques such as Naming and Activation Services, Dependency Injection, and Duck Typing. Much of the work underlying Microsoft's implementation is based on community feedback. Krzysztof Cwalina writes,

The direct engagement with the DI community is also starting. We gave a talk on the technology at last week’s MVP Summit, and talked with Jeremy Miller (the owner of Structure Map) and Ayende Rahien (Rhino Mocks) . We got lots of great feedback from Jeremy and Ayende and I think their experience in the DI space and their feedback will be invaluable as the project evolves. Thanks guys! We are of course also looking forward to engaging others in the DI community.

While still in the early phases, some early examples of the syntax are available. In .NET tradition, it is based on attributes rather than XML or explicit object passing.

Other Resources by Al Tenhundfeld Posted Apr 28, 2008 10:50 AM
MS has used DI for quite a while by Jim Leonardo Posted Apr 28, 2008 3:55 PM
ORM, DI, all of this stuff made popular in Java long long ago. by serge boulay Posted Apr 28, 2008 3:58 PM
Where is Castle? by F Quednau Posted Apr 29, 2008 8:11 AM
Re: Where is Castle? by Al Tenhundfeld Posted Apr 29, 2008 10:18 AM
  1. Back to top

    Other Resources

    Apr 28, 2008 10:50 AM by Al Tenhundfeld

    If you're interested in this topic, I'd also read the earlier interview on Unity. http://www.infoq.com/news/2008/04/microsoft-unity

    And some popular open source DI frameworks:
    Ninject (new but looks very impressive)
    http://ninject.org/

    Spring.Net (port of the very successful and established Java framework)
    http://www.springframework.net/

  2. Back to top

    MS has used DI for quite a while

    Apr 28, 2008 3:55 PM by Jim Leonardo

    MS has used DI as the core for configurability of the Enterprise Library for a long time now, so the real news here is that they're finally making it a focus for a product team rather than just the patterns and practices team. What's good to hear is the engagement with others.

  3. A technique that has long existed in the java world and has been the norm for some time now.

  4. Back to top

    Where is Castle?

    Apr 29, 2008 8:11 AM by F Quednau

    Should it not at least get honorable mention? http://www.castleproject.org/container/index.html In my opinion I still cannot believe the way Microsoft treats extremely popular and successful Open Source Projects. It's all there guys, and we can embrace it NOW.

  5. Back to top

    Re: Where is Castle?

    Apr 29, 2008 10:18 AM by Al Tenhundfeld

    Why would you recommend Windsor Castle over Spring.NET? I have heard good things about Castle, but I've not taken the time to sit down and play with it.

    Right now, I'm excited about Ninject. If you haven't looked at it, I recommend you do. In my opinion, if you all you want is an intuitive, usable IoC container, Ninject is far better than Spring.NET -- although I believe they're still working on the performance. I'd be very interested to hear your thoughts on Castle v Ninject also.

Educational Content

Bindings, Platforms, and Innovation

This presentation focuses on the Internet and separating myth from fact, history from the future, and the mundane from the imaginative. Bob Frankston presents a vision of what could and should be.

Orchestrating Long Running Activities with JBoss / JBPM

This article explores the use of JBoss and jBPM to implement design solutions that effectively address the issue of orchestrating long running activities.

Neo4j - The Benefits of Graph Databases

This presentation covers the use of graph databases as an optimal solution for data that is difficult to fit in static tables, rapidly evolving data or data that has a lot of optional attributes.

Realistic about Risk: Software development with Real Options

This session introduces Real Options and shows how it can help in running your project. Real Options is a decision-making process that can be used to manage risk.

Communication Flexibility Using Bindings

This article discusses the use of bindings on services and references (including the instance of non-configured bindings) as the means to implement SCA communications in a Web and SOA environment.

Writing DSLs in Groovy

After a short introduction to DSLs, Scott Davis plays with the keyboard showing how to approach the creation of a DSL by typing working snippets of Groovy code that get executed.

Scaling Agile with C/ALM (Collaborative Application Lifecycle Management)

IBM Rational and InfoQ present, Scaling Agile with C/ALM, an eBook showing organizations how to become “finely tuned software delivery machines” by enabling team integration and scaling.

Concurrent Programming with Microsoft F#

Amanda Laucher presents a real life enterprise application written in F#. She shows actual code snippets, explaining design decisions and suggesting how to use some of the F# constructs.