Freigeben über


Clarification on Changes in CWAB's Dependency Injection

David Hayden recently posted (ObjectBuilder WorkItem - Just Implement Windsor Features), in which he misunderstood one of my comments about the changes in DI that were made in CWAB:

On a similar note, Michael Puleio seems almost apologetic in his post about breaking changes in the Composite Web Application Block with regard to dependency injection for Pages, User Controls, and Master Pages:

“Note: I know this is now not truly doing by the book dependency injection. However, with the toolset and framework we are building on, it is the best we could do to keep things simple, reliable, and consistent.“

I think this has something to do with the limitations in ObjectBuilder, although you won't hear anyone say that...

Let's take this a one point at a time.

First, I am apologetic.  Breaking changes in public interfaces really suck for developers who depend on those interfaces.  I've been on the other side and spent days fixing code that relied upon interfaces that changed between versions.  We thought long and hard before making any breaking changes.  When we did, we also evaluated each breaking change in isolation against this criteria: "Is this important enough to do, even if we did not make any other breaking changes?" 

Second, my statement "with the toolset and framework we are building on, it is the best we could do".  The toolset and framework I was referring to was ASP.NET (sorry guys...), not ObjectBuilder.  There are no hooks in the ASP.NET Page lifecycle[*] that allow you to override the calls that new up UserControls and MasterPages.  We invested a lot of time trying to squeeze something in. We talked to the ASP.NET team.  They told us it was impossible. So, we have the "please inject my dependencies" approach instead.

I admit ObjectBuilder is not perfect[**] (no one ever said it was).  But that was not the gist of my comments or my post. 

 

[*] Chris Tavares and I have spent a lot of time ensuring that the hooks we want exist in the ASP.NET MVC framework that was announced at ALT.NET and has been talked about a lot recently.

[**] If you want to see some great changes in OB, look at the source available on CodePlex in the ObjectBuilder project.  Brad and Scott (from the CodePlex team, and formerly from p&p) have made some updates in a branch of the code that are great.  p&p is considering the possibility of taking these changes and re-vamping ObjectBuilder.

Comments

  • Anonymous
    October 22, 2007
    PingBack from http://msdnrss.thecoderblogs.com/2007/10/22/clarification-on-changes-in-cwabs-dependency-injection/

  • Anonymous
    October 26, 2007
    Can P&P team get enough strength and decide the Object Builder future? If it is not feature comparable (and there are not plans to become in the future) with Windsor or Structure map, then why not just adminiting and refactor builder's non DI specific things into separate componenent and plug in winsdor or any other DI framework. If the P&P finds Object Builder competitive and potential enough, why you don't put some serious more serious efforts in breaking the bad ranting karma which is been built recently. Is it possible that one guy (even as smart as he is) builds on his own DI freamework (Structure Ma)p and that all the P&P people can not compete with him?