Don't worry, I'm just getting this out of the way pre-emptively Scott Hanselman's fourth screencast *confirms* that the interfaces and abstractions made as part of the MVC (HttpContextBase, IHttpRequest, IHttpResponse, etc.) will not be put into the existing Webforms model. That means that once MVC is released, the old HttpContext object in WebForms will *not* inherit from HttpContextBase, nor will the WebForms versions of HttpRequest and HttpResponse objects implement the interfaces. I don't believe anyone was sure of this happening anyway, but now it is definite. From about 22 min into the final of the four screencasts:
"There are certain things we would have wanted to have done, for example we would have loved to have pushed out our [HttpContextBase] and our testable interfaces deep down into System.Web, so that other ASP.NET developers could get that functionality as well. But that would have involved massive changes to the already well-tested codebase of ASP.NET WebForms. So there are some things that history will not allow us to do, or at least, is going to slow us down."So if you want to have some easy abstractions around these objects with the good old WebForms model to ease your testing and TDD pains, you have many, many choices:
1) Write wrappers for pretty much *everything* yourself.
2) Forget about testing stuff like that
3) Wire up your own MVP pattern for it
4) I lied, there's really only those choices
Now, once again, like NMock, this doesn't matter all that much to me - I've been moving away from the WebForms model anyway and now Microsoft has made the decision between the two models academic.
All of the cool extensions and abstractions to give ASP.NET web applications better testability are only happening in the Microsoft MVC. Not only that, but the screencast is also implying through the "we would have loved to do this, but we can't" message that what is being done in the MVC is a recognizably better way of doing things than what is happening in the Webforms model. However, due to historical reasons WebForms is stuck with that model while everything else evolves. That's right, my friends,
WebForms will be the new legacy system!
To me, this is *huge*. In fact, for any of you that have been having problems pitching Microsoft MVC in the past,
this is even bigger news for you. I have insanely good looks and absolutely ridiculously awesome hair to rely on, so it really doesn't matter what I say; people agree with me naturally. Some of you out there might have to rely on things like *facts* to convince *your* stakeholders to use the MVC. And now you've got your facts - if you are looking to have a unit-testable web application (and trust me, I've got a *boatload* of metrics to indicate that is preferable, if that's really your bag)
WebForms cannot be that choice for you. And yes, for those of you about to tell me all about the glory of Monorail, I know! But of the Microsoft MVC or Monorail, which one do *you* think is going to be easier to pitch to "BigCo Inc."?
At my presentation in DevTeach (this again! Really, I should post about it already) I implied -jokingly - that MVC was your *only* choice. Now this time it's Microsoft implying it, but I don't think they are kidding!
Do you remember the whole
religious war several years back about VB vs. C#, and how people would
fight for ages about whether one language was better than the other, or
whether you were
even a better developer for choosing one over
the other? Those were crazy times, thank goodness that got worked out
- oh wait, no it didn't. Well, guess what - those days are here
again, but
worse.
And you thought
*NMock* was in trouble?
[update: the previous three parts in this series can be found by clicking below:
MVC Preview 1 to Preview 2 Part A
MVC Preview 1 to Preview 2 Part B
MVC Bombshell #1]