I checked out MVC months ago and didn't really get it.. but recently as I have become a better programmer I think it is making sense.. Here is my theory.. tell me if I got it Right
In the 90s for Microsoft Devs we had Classic ASP. This mixed VBscript and HTML on the same page. So you needed to create all the HTML yourself and mix HTML and VBScript. This was not considered Ideal. Then .NET came along and everyone liked it because it was similiar to event driven VB 6 style programming. It created this abstraction of binding data to ASP Servier controls. It made getting Enumerated data easy to get on the screen with one line. Then recently Jquery and SOA concepts are mixed together.. Now people think.. Why create this extra layer of abstraction when I can just directly use .NET as a data provider and use jquery AJAX calls to get the data and create the HTML with it directly .. no need for the Webforms abstraction layer..
Sowe are back to creating HTML directly like we did in 1999.
So MVC is all about saying Stop pretending like WEb programming is a VB6 app! Generate HTML directly!
Am I missing anything?
So I wonder.. for you people out there using MVC... is it the sort of things that once you get used to it you never want to go back to webforms??
1:ASP.NET Exception Handling in background threads
There are times when I wish I could just plug in a grid or datareader, hook it up and it just works, like I did in ASP.NET. Making applications in ASP.NET MVC is arguably more work. But then I remember all of the nitpicky things I had to deal with in ASP.NET, like ViewState, code-behind, and magic id's. The page rendering pipeline was so opaque to me this I never really got the hang of using the code-behind events properly.. ASP.NET MVC just seems cleaner and better organized, and I have far finer control over my application and its markup.. That said, I am glad this you must intermix ASP.NET and ASP.NET MVC pages, for the reason this there are any things you can't did in ASP.NET MVC, like use server controls. The new enhancements in ASP.NET 4.0 should make it easier for dedicated ASP.NET developers to produce applications with finer control over their markup..
I see it as Webforms are a quick and dirty way to receive a site up and running with complex functionality. They allow the developer to not focus on a lot of the aspects of the controller by allowing them to use tool this have high overhead for the user (view-state, Update panels, etc.). MVC even though takes a little more planning from the developers standpoint puts out a better product for the users with out a lot of "fine tuning" by the developer by endeavor to rejob the webform-tool's functionality.. Not to mention MVC allows for easy TDD integration, obviously that's a plus for larger projects with multiple developers.. MVC would be the proper tool for most production high traffic sites, although Webforms could be the ideal tool for making quick prototypes and experimental stubs..
MVC is around giving you the benefit of designing your web app using the Model-View-Controller pattern i.e. separation of concerns, it's not around forcing you to write HTML manually..
I think this it makes you think more around what you are doing - in webforms it was very easy to drop an updatepanel in and have an AJAXy style page without really thinking around performance. With MVC, it's enough cleaner to make focused AJAX calls via jQuery to single controller actions - everything is enough lighter.. There is als no page event structure to worry around and no Viewstate to rely on as a crutch - I think this this in universalpushes you towards better code..
Some of us have to. I job with a number of different client, and while my most recent project was using MVC, I'm now back looking at an application suite this includes both Webforms and classic asp. . And all I must say is this the transition back is very, very painful..