You may have ready my article on the death of ASP.net WebForms. In summary we can say that WebForms is becoming obsolete, because Microsofts vision of hiding the web-complexities from the developer and giving her a Visual-Basic style programming environment failed.
Along came MVC to provide a new solution. And there are quite a few things it's done very, very well. And a lot of things that won't make it. Our goal is to focus our time and energy on the relevant parts and ignore the rest.
In this part 4 of my Series The Future of DNN Speaks Razor, I'll explain why ASP.net MVC started well but was overtaken by the internet, and why the resulting good solution is still called MVC, even though it's not Model-View-Controller.
ASP.net MVC is Dead…
ASP.net MVC completely turned around Microsofts Visual-Basic-style approach to the web: This time, it was "embrace the web" and leverage what it does. Suddenly it was all about testability, patterns, Dependency-Injection, Inversion-Of-Control, Routing, Dynamic Objects and more. And it was a very tough start.
It looked great on paper - the same way a business plan looks great on paper. And in practice it also felt like a business plan - academic and unrealistic. The technology and solution was just too trivial to produce great solutions. A classic problem was that you suddenly had loads of tiny fragments of a solution to manage. And getting these to work together felt simple - as long as your solutions were at demo-level and trivial. Suddenly the platform didn't do much anymore, and many things it did (like adaptive views for mobile devices - see my post on Responsive vs. Adaptive) were ivory-tower leftovers and not really relevant.
The start was so tough that for many years, third-party controls simply sucked. Getting something like a WYSIWYG control (like the classic telerik rad-editor) in MVC was like picking up your kids bike to replace your car. It may feel like you're going green, but you're not going anywhere!
To the left you see the amazing MVC-Telerik editor - and it's easy to see that the non-MVC-edition to the right was a bit better at the time...
Third party controls finally got better - when they started doing everything in JavaScript. That's right: they got better, when they stopped relying on ASP.net MVC. This became obvious when the control makers (incl. Telerik) started marketing their controls to also work with Java and PHP. Of course they work - they are simply HTML, CSS and JS!
Here the newest non-WebForms editor. Better (because zero-ASP.net) but still not even close to the WebForms version.
…because MVC is Now Happening on the Client, not on the Server…
Think about the "cool" UIs you see today, like a powerful mail client (Google, Outlook), a neat game, a stylish business UI. All of them have in common, that the entire View is client rendered using AngularJS, knockout or Kendo.
the two most popular MVC-style frameworks in JS at the moment
Today's SPA (Single Page Application) receives a generic HTML, a generic JavaScript and a generic CSS. I'm saying generic because these pieces don't vary with URL parameters or with user logins. When the server was in charge, each request delivered a different HTML, usually containing the tables, the data, fragments of the JS and more. This is passé.
But when the server doesn't have to deliver different content-fragments based on URL or session state, what good is programming on the server? Why play MVC on the server if you already do it on the client? The simple answer is: you don't. The need for MVC on the server is collapsing…at least for Apps (content-management is another story).
You won't Notice MVC on the Server Failed, Because they Rethinged the Name
That's right! Some things get renamed, but MVC got re-thinged. I guess Microsoft realized that another name would further confuse everybody - and anger all the early adopters who already had a hard time getting into MVC. Imagine telling them "Yeah, it was hard, and it sucked, and it was unproductive - but in the long run, we don't need it any more." That's a recipe for losing developers. So Microsoft opted for the "MVC got much better, it now also does lots of new things that don't have to do with MVC. You can also use this now!"
Examples of how the Name MVC got Re-Thinged
Most of the really important new features in ASP.net (and supposedly part of MVC) have little or nothing to do with Model-View-Controller Separations-Of-Concerns in the view-layer of an application. Here some examples:
- ASP.net WebAPI part of MVC 4 - a data layer if ever I saw one, ideal for JavaScript applications
- Razor - a text-parser if I may say so - was heavily marketed as part of MVC 4
- SignalR 2 (http://www.asp.net/signalr) part of MVC 5 - real-time communication, ideal for JavaScript applications
Other features like Routing etc. are awesome but they are basically necessary for any kind of web site incl. WebForms and CMSs in general (irrelevant of the framework-flavor below).
But to keep things simple MS choose to keep the name MVC. It'll get more complicated when they start promoting Katana etc., but for now they call new things MVC. I believe this will change in 2015...
The Browser is the better MVC-Playground
I would like to add a note on a common misconception: MVC is a View-Layer Pattern. I've met many programmers who try to place the business and data-layer in the "M" or "C" layer of MVC (model or controller). Both are completely and utterly wrong - M,V, and C are not the tiers 1,2 and 3 of an n-tier-solution. MVC is a way to split the view-layer (the top layer of the n-tier solution) into 3 Separations-of-Concerns. You still need a business and a data layer in an MVC-App.
Doing M, V & C in the browser is much easier because the three parts are connected, live and receive mouse-interactions. Doing this on the server was just frustrating, difficult and totally unsexy for the end user.
In Summary MVC is dead on the Server…
So the basic MVC-concept, replacing the VB-Style Page/View separation with a Model-View-Controller-Style separation on the server is history. Todays and future web applications will embrace MVC / MVVM / MVP - but they will do it on the client. ASP.net will be an important layer in the application stack, but not because of MVC.
Not all is Lost…
Because the server still serves an important role in many other sub-function, incl. Data-Delivery. That's where Microsoft built a masterpiece with the WebAPI. More on that tomorrow…
With love from Switzerland
Daniel
Daniel Mettler grew up in the jungles of Indonesia and is founder and CEO of 2sic internet solutions in Switzerland and Liechtenstein, an 20-head web specialist with over 600 DNN projects since 1999. He is also chief architect of 2sxc (2SexyContent - see forge), an open source module for creating attractive content and DNN Apps.
PS: Want to get started before the entire Razor-series is out? For the impatient, try the DNN-Razor Host Module and watch this video or try packaged code apps by installing 2sxc and some of the Razor Apps like the Razor Basic Tutorials, List-Tutorials or the SQL and Peta-Poco Tutorials.