ASP.NET MVC - WebForms Unplugged
As a new Microsoft employee, I like the new-found pragmatism at the Microsoft Developer Devision, typified by projects like the ASP.NET 3.5 Extensions and MVC. Certainly we all know MVC as a concept is nothing new, but it is new as a philosophy for the ASP.NET team (IMHO).
Remember that ASP.NET WebForms render using a Control Hierarchy which is fundamental to the whole gestalt of what we think of as ASP.NET. You put an <asp:label> inside an ASPX page and as soon as you mark it 'runat="server"' you've added it to the Control Hierarchy. Any string literals around your control also become part of that hierarchy of objects. The PreRender event is an opportunity for you to affect that tree of controls before the Render event fires and they turn into Angle Brackets (usually HTML). ASP.NET represented a swinging of the needle, as it were, from the Classic ASP way of doing things to an artificial event model that gave us state where there was no state. It added layers and production value and it sounded good, and still sounds good to lots of people.
However, this leaves a gap in the music. Sometimes I just want to control the stream myself. I want the system to step aside and let me get down to it. Not all the way aside, but certainly out of my general field of view. MVC Frameworks with View engines like ASP.NET MVC and Monorail's many template options and the Django template language and HAML...
(Note to self, write HAML view factory for ASP.NET MVC. UPDATE: Crap! The brilliant Andrew Peters made NHAML this last month and added it to MVC Contrib. New Note to self, crush Andrew Peters for being too awesome.)
…provide a fresh clean new sound to the same old angle-bracket-based music of the past. Clean, simple, lightweight.
Is it MVC that makes this possible? Partially, but we mustn't forget the huge influence of sites like http://www.csszengarden.com and the minimalist markup aesthetic promoted by CSS folks and standards wonks changed the way we think about markup and what can be accomplished with a few H1s and a UL/LI or three.
In a recent MVC design meeting someone said something like "we'll need a Repeater control" and a powerful and very technical boss-type said:
"We've got a repeater control, it's called a foreach loop."
Zing! That's so cool. Get out of my way and let me make some angle-brackets. Again, not for everyone, but for enough people that matters. Open Source projects like MVCContrib and hopefully a bunch of 3rd party component vendor types will drink in that simplicity and the power of statements like that and create helper methods and controls that we want, need and can use, and not just <mvc:TooBigDataGrid/>.
This is a not just a different tune, but a whole different band playing all new music. Not everyone will like the music, and that's why the world has more than one band. This is a Good Thing.
I like to think of ASP.NET MVC as the raw, acoustic version of the more heavily produced and multi-layered ASP.NET WebForms we use today.
I hope the pure intent and zen-like simplicity of a nice clean MVC design stays that way. Sometimes I want to listen to Kanye West, but sometimes I want to listen to John Legend. Or, insert your own musical analogy here. Either way, it's ASP.NET Unplugged as far as I'm concerned.
- ScottGu MVC Presentation and ScottHa Screencast from ALT.NET Conference
- ASP.NET 3.5 Extensions - plus MVC How-To Screencast
- DevConnections - The ASP.NET MVC Framework
- DevConnections and PNPSummit MVC Demos Source Code
- Hanselminutes Podcast 55 - MonoRail as Alternative ASP.NET