ASP.NET MVC is MUCH better than MS seems to think

Here at DevConnections I just attended the ScottGu’s keynote on Visual Studio 2010 and Web development. I haven’t had much time to spend on the latest Beta of Visual Studio 2010 yet so I found most of the information quite helpful and interesting. It looks like Microsoft is finally coding some good functionalities from ReSharper and .NET Reflector inside of Visual Studio 2010.

Little gems like “Generate stub method” or “Display the hierarchy of calls” are now available natively. Still ReSharper is a must I think, but it is good to have a really better VS. By the way, I haven’t seen yet a preview of ReSharper for VS 2010 so the gap might still be quite large J

My primary focus these days is for ASP.NET MVC as I’m doing—guess what—a book scheduled for the release of the .NET 4 platform next April. I particularly loved the TDD spin of ASP.NET MVC that is visible from tooling support. I’m not simply emphasizing the possibility of doing unit tests; I’m referring to the possibility of writing tests first and then the code. And here’s that facilities like stub method and types generation come into play.

And finally, I respectfully but strongly disagree on the slant of many Microsoft presentations that touch on ASP.NET MVC. I disregarded ASP.NET MVC for too long. Now that I got to know it from the inside, well, it’s the best (large) piece of code I’ve seen for a long time.

It’s much better than MS seems to think and tell.

In my opinion, it really represents the way to go for most developers in the mid term. It is probably premature to suggest today that Web Forms be abandoned to embrace ASP.NET MVC. But the new framework (in version 2.0 with Visual Studio 2010) drives you toward better code. Don’t get it wrong: ASP.NET MVC doesn’t automagically make your code clean, elegant and flexible. You still have to go a long way ahead but it puts you on the right track and delivers an environment where you can write testable and practice seriously with unit testing.

A point that Scott made about ASP.NET MVC is that it gives you total control over HTML. Not that this is a false statement, but it happens because server controls are marked as evil. They still work (even though their use may compromise the design—hold on) if you want and if you use the increase your distance from HTML. But on the other hand, if you stop using server controls in Web Forms you get closer to the HTML metal also in Web Forms. So in the end the reason for using ASP.NET MVC is Separation of Concerns and testability.

Eventually, Microsoft will be able to add that to Web Forms too, perhaps via the MVP pattern as the Web Client Software Factory framework attempted to do a while back. 

Published 11 November 2009 07:08 AM by despos
Filed under:

Comments

# Twitter Trackbacks for ASP.NET MVC is MUCH better than MS seems to think - .NET Architectonics [asp.net] on Topsy.com said on 11 November, 2009 03:07 AM

Pingback from  Twitter Trackbacks for                 ASP.NET MVC is MUCH better than MS seems to think - .NET Architectonics         [asp.net]        on Topsy.com

# Michael K. Campbell said on 11 November, 2009 03:16 AM

Problem is, Microsoft can't just tell people how great MVC is without people worrying that WebForms will go away. Personally, I'll NEVER do webforms again.

I do somewhat argue with your take on WebForms getting you closer to HTML metal if you don't use controls. Not that you're NOT correct - just that if you do that, you'll be wiring up a LOT of your own stuff on anything other than read-only pages. In other words, I think that MVC does a MUCH better job of letting developers interact with and code their sites/logic because the wiring is done so intelligently, painlessly, and efficiently with model binders (i.e., accessing method parameters is soooo much nicer than accessing controls). Add to that the natural TDD/SoC benefits, and yeah, MVC is a complete winner in my book. (So much better than WebForms.)

That, and I get FULL control of my markup. That's huge and something I'd almost place ABOVE TDD and SoC if it weren't for the fact that SoC makes my code so much better and easier to manage.

# Jon Sidnell said on 11 November, 2009 03:33 AM

"But on the other hand, if you stop using server controls in Web Forms you get closer to the HTML metal also in Web Forms"

Except that even if you do this, there's still a whole slew of HTML that WebForms injects into your pages that you never wrote! Thinks like hidden form values, innumerable references to ScriptResources and so on. I am using WebForms with minimal runat="server" at the moment, and this extra stuff is still there and it's still bugging the hell out of me!

All of which is to say, yes, MVC is much better than MS seem prepared to admit. Personally, I think it'd be best if they just admit that WebForms was an innovative, if misguided, approach to Web development, and just deprecate it after v4.0.

# Isreals New Forum Propaganda Division | Advertising Marketing Wisdom said on 11 November, 2009 07:49 AM

Pingback from  Isreals New Forum Propaganda Division | Advertising Marketing Wisdom

# Roger Pence said on 11 November, 2009 10:14 AM

How do you think Plan 9 factors into all of this? What little I know about it scares me--you don't simplify a two-way decision by adding a third.

# Jeffrey Palermo (.com) said on 11 November, 2009 10:22 AM

Dino Esposito , from whom many of us have read and learned a great deal over the years, has recently expressed his love for ASP.NET MVC.  Moreover, he has also notice that the message from Microsoft is very tentative about the framework.  Because

# Raghuraman said on 11 November, 2009 10:32 AM

Dan,

You are partly correct that ASP.NET MVC is much better than what MS seems to think. But at the end of it ASP.NET MVC is good and slim, but it is a "one step back" for those comfortably placed with Webforms application.

It is another tool for getting the work done.

We never think of complexities while still at the drawing board.

It is too early for MS to put all of the weight behind MVC.

# despos said on 12 November, 2009 12:09 AM

@Michael, @Jon

You're right that MVC makes it easier/better to deal with raw HTML; it is kind of incorrect that you have to choose MVC if you want to control HTML. As Jon pointed out in WebForms you still get a lot of extra stuff even with minimal runat=server. But on the other hand MVC doesnt use any form of controls. If you plain HTML plus code blocks in Web Forms it'll work like in MVC. In my opinion the correct statement is: ASP.NET MVC makes it easier and less painful to control your HTML. This results mostly from neat separation between processing and rendering.

# despos said on 12 November, 2009 12:16 AM

@Dan

MS is certainly aware that the big drawback for MVC to attract all developers is the lack of a component model for the view. However, if MS or vendors create just that the total control over markup will be progressively lost. Not having a clear idea of the optimal strategy--and not having anybody in the community a neat proposal--MS postpones any push to better times.

It's a nice discussion whether we should ask or not for a component model in MVC. I think so; the guys who absolutely want to control their own markup are OK with today's HTML helpers. The others can have a simpler life.

So MS may be OK to hold. Developers, instead, should move towards MVC, or at least make  a serious effort to understand it. Web Forms is de facto deprecated--whatever MS says. Architecturally deprecated. BUt this is a natural fact. Web Forms is 10 years old and was designed to address different needs. MVC has a more modern design and meets today's needs.  Waiting for an official word from MS, wake up and understand it :) Understand, not just get used to it ...  

# carte sdhc 16gb said on 15 December, 2009 08:48 AM

Here at DevConnections I just attended the ScottGus keynote on Visual Studio 2010 and Web development. I havent had much time to spend on the latest Beta of Visual Studio 2010 yet so I found most of the information quite helpful and interesting. It looks like Microsoft is finally coding some good functionalities from ReSharper and .NET Reflector inside of Visual Studio 2010. Little gems like Generate stub method or Display the hierarchy of calls are now available natively. Still ReSharper is a must.

# DataEntryGuy said on 29 December, 2009 12:22 PM

Greetings

This post really makes sence and is   informative.Would You let me use this information on my blog? I would link back to your blog?

Thanks

# Rod Rye said on 01 February, 2010 09:38 AM

I think MVC is the way to go for any medium-large application, but web forms for something that goes from concept to implementation within a week and has to go into the hands of non .NET developers to write the HTML, is the only way to go.

For smaller sites TDD isn't an advantage because the whole site has to be live in less time than it takes to write tests.

I don't think either web forms or MVC is 'better', they each have their target market, theoretically though you could use web forms for everything (with a slight performance hit and dealing with a viewstate), but you can't use MVC for everything, without facing a development cost disadvantage (for smaller sites).

Leave a Comment

(required) 
(required) 
(optional)
(required)