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.