DevConn07 Fall:: MVC FX is it car or motorcycle?
The MVC Framework is the next (not necessarily big) thing for ASP.NET developers. ScottGu unveiled some of its aspects a few weeks ago. Today here at DevConnections I attended a presentation about this new stuff. First off, the "new stuff" is really new and for the time being we're not allowed yet to play with it. No CTP is available at this time and no sample code is available for home perusal.
This is reasonable because we're clearly talking about a technology that is not even in alpha. But the funny thing is that we're here talking about it :)
<grin>
It seems that the bar of software preview has been moved one more tick down. There was a time when any software was top secret until publicly released. Next, we assisted to pre-release announcements and demos. Next, we were allowed to play ourselves with beta versions for longer and longer times. And our feedback was first appreciated and then requested. Next, it was the season of CTPs, progressive alpha versions that precede the beta stage--the teen-age of software.
With the MVC framework we reached the notable point of publicly discussing a piece of software that is not even a CTP. I wonder what would be the next step. Discussing ideas, I bet. And after that?
</grin>
So the ASP.NET MVC framework. I totally agree with one of the sentences in the intro slide. The MVC framework is not Web Forms 4.0 but is simply an alternative to it. Like with cars and motorcycles, each has pros and cons, and everyone can find it simple or complex based on his/her preferences and attitudes. The MVC framework blinks at the Model-View-Controller pattern and apparently transmits the idea that just the MVC pattern represents its main aspect. But wait a moment. I just said that the MVC framework represents an alternative to Web Forms. Which is largely true and correct. And then? If the MVC framework is all about the MVC pattern, does it mean that the MVC pattern represents an alternative to Web Forms? Put this way, we're simply comparing apples and oranges.
So what's IMHO the main aspect of the MVC framework? It uses a REST-like approach to ASP.NET Web development. It implements each request to the Web server as an HTTP call to something that can be logically described as a "remote service endpoint". The target URL contains all that is needed to identify the controller that will process the request up to generating the response--whatever response format you need. I see more REST than MVC in this model. And, more importantly, REST is a more appropriate pattern to describe what pages created with the MVC framework actually do.
Is there any MVC in it? Sure, there is. The team just used the MVC pattern to implement a framework that adds REST capabilities to the ASP.NET platform. With this new framework you don't need the viewstate to save the last-known-good-state of each page and the postback model with all of its events is gone. Why? There's just another HTTP handler to serve the request and this new handler just figures out which action to carry out, grab data (the model), calls the appropriate method (on something called the controller), collects its output and prepares the response--called the new view. In my opinion, the MVC pattern is instrumental to implementing an alternative model for Web requests.
In this context, MVC is like XML in AJAX. It's neither the main actor nor the main factor. But it's in the name of the technology because, perhaps, it makes it cool. As I'll be explaining tomorrow MVC or MVP (Model-View-Presenter) can be applied to ASP.NET pages regardless of the model they use for posting back to the server.
Your take?