views:

221

answers:

6

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??

A: 

MVC is about giving you the benefit of designing your web app using the Model-View-Controller pattern i.e. separation of concerns, it's not about forcing you to write HTML manually.

James
True, but oddly enough, it's the separation of controls which forces you to write the html. Letting the Html do its thang, separating it from any logic that would write the angle brackets for you. I see your point, though.
Atømix
I tihnk I like doing the HTML myself. But where are the official jquery client side templates from microsoft ?
punkouter
@Atmoiton: You can still use a visual designer though, its not as though you *have* to write the HTML manually. @punkouter: I agree I always write my HTML by hand, using designers usually add a lot of unnecessary markup.
James
A: 

I think that it makes you think more about what you are doing - in webforms it was very easy to drop an updatepanel in and have an AJAXy style page without really thinking about performance. With MVC, it's much cleaner to make focused AJAX calls via jQuery to single controller actions - everything is much lighter.

There is als no page event structure to worry about and no Viewstate to rely on as a crutch - I think that this in general pushes you towards better code.

Paddy
And SL4 is moving towards MVVM. So I think anything that can push me to use better patterns I should try out.
punkouter
+1  A: 

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 that 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 that you can intermix ASP.NET and ASP.NET MVC pages, because there are some things you can't do 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.

Robert Harvey
So as a experienced MVC dev.. Do you generally want to just do your ASP.NET apps with MVC from now on ?
punkouter
Yes, generally. But there are some existing ASP.NET apps that will have to be integrated into my current application, and I doubt that they will be rewritten from scratch. That's the rub, you see. ASP.NET MVC is quite different structurally and philosophically from ASP.NET, and your shop already has a substantial investment in ASP.NET.
Robert Harvey
problem with MVC is the benefits of using it come over time.. So the non-tech boss who wants to know why I must use it won't be impressed by that answer.
punkouter
Indeed. It is entirely possible that ASP.NET MVC is not a good fit for your organization at this time. The decision to adopt it would have to be based on more than just a coolness factor.
Robert Harvey
A: 

I see it as Webforms are a quick and dirty way to get 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 that 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 trying to rework 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, but Webforms could be the ideal tool for making quick prototypes and experimental stubs.

Glennular
+4  A: 

God, I love MVC so much I don't even think words can capture how I feel :)

From time spent developing something viewpoint, I think that MVC and WebForms are equal.

In WebForms I would spend many hours fighting with DataGrid and other controls to do what I want and how I want it. And not to mention many many hours replacing UpdatePanels with jQuery from sites where it wasn't a viable solution anymore (performance wise).

In MVC I start with a blank slate and mold it to suit my needs. Need I say more?

EDIT: I just found http://aspnetmvc.componentart.com/

Vnuk
wow those are some beautiful designs on that website. Good to reference from as well for some reason they allow you to pretty much mimic their structure if you view page source you can create the same or even better design without paying a subscription fee. Its so easy to create your own HTMLHelpers. I LOVE MVC :D
Ayo
A: 

Some of us have to. I work with a number of different client, and while my most recent project was using MVC, I'm now back looking at an application suite that includes both Webforms and classic asp.

And all I can say is that the transition back is very, very painful.

chris