Web Forms vs. ASP.NET MVC

Probably I'm a bit late to the party, but as I gain confidence with ASP.NET MVC I feel I have my cents to share :-) 

ASP.NET MVC is not the anti-Web Forms and Web Forms is not the anti-pattern of ASP.NET development. ASP.NET was created 10+ years ago and in the late 1990s the MS platform was VB-oriented. So it was a natural choice to design ASP.NET as a stateful framework over a stateless medium--the Web. Many of the hot features in ASP.NET (postback, viewstate, forms authentication/authorization, server controls and abstraction over HTML) were eagerly welcomed by the community because they were time-saving facilities just implementing common features that everybody would have aboard.

Over years, MS probably failed drawing Web people attention on architecture and software design. There was an interesting attempt made with the Web Client Software Factory to implement MVP and workflow-based page navigation in Web Forms pages, but that turned out to be too far complex. At least, in my opinion. So in some way instead of driving Web Forms towards a better design it seemed preferable to introduce a new framework on the wave of the success gained by RoR and MonoRail. To many people, ASP.NET MVC looks like the new way to go and the only way to achieve SoC, testability, better design.

For sure, ASP.NET MVC is a "new" ASP.NET designed ten years later looking at the current state of the industry and evolution. Comments on Web Forms vs. ASP.NET MVC are often biased and stuffed with pieces of personal experience that is elevated to the rank of absolute, objectives facts.

The table below lists my top-ten undisputable facts about ASP.NET MVC and Web Forms. These are facts--everything else, I believe, are opinions. And like all opinions they are fully respectable. At the end of the day, Web Forms and ASP.NET MVC is like car or motorcycle and ... it's up to you, your skills, your education, your attitude, and your project requirements.

  1. Web Forms is hard to test
  2. ASP.NET MVC requires you to specify every little bit of HTML
  3. ASP.NET MVC is not the only way to get SoC in ASP.NET
  4. Web Forms allows you to learn as you go
  5. Viewstate is not the evil and can be controlled/disabled
  6. Web Forms was designed to abstract the Web machinery
  7. ASP.NET MVC was designed with testability and DI in mind
  8. ASP.NET MVC takes you towards a better design of the code
  9. ASP.NET MVC is young and lacks today a component model
  10. ASP.NET MVC is not the anti-Web Forms

On this topic, an article on MSDN Magazine is coming out in the July 2009 issue. A Web architecture book is being published these days and I'll start soon on the MS Press big book guide on ASP.NET MVC to be available towards end of the year.

 

Published 11 April 2009 01:03 PM by despos
Filed under: ,

Comments

# SergeyS said on 12 April, 2009 11:12 AM

You were one of the first to applaud to ASP.NET 2.0 Script Callbacks. (Out-of-band callbacks - you called it, or out-of-bound callbacks according to ScottGu back in 2004, if I remember it correctly)

They wrapped it into MVC paradigm putting down other ways Script Callbacks could be used in. Sad story, great losses.

ASP.NET 2.0 Script Callbacks combined with IE specific Javascript window.execScript() might have generated much better paradigm.

They need to rethink the concept of the procces of dev tools strategic decigion making, in my opinion.

# Tiago said on 13 April, 2009 04:32 AM

Hi.

A year ago you weren't very fond of ASP.NET MVC. Even the testability didn't impress you.

What made you change your mind?

# despos said on 14 April, 2009 09:38 AM

Correct :) About one year ASP.NET MVC didn't look particularly attractive to me. In general, I don't like the endless sequence of CTPs and intermediate builds through which MS seems to require feedback. Like many others, I'd say, I have no time to waste looking at what MS is doing. I'm happy instead to look at what MS did at least as a Beta. So I seriously started looking at ASP.NET MVC only in November 08, a few days after the Beta 1. I'm still convinced that many people look at ASP.NET MVC because they *feel* they have to in order to write cleaner and better code. Which is not true.  So testing and SoC per se weren't reasons to look at ASP.NET MVC in a so early stage. After Beta I say that I've found an interesting product and a different perspective around ASP.NET.

# Will Steele said on 14 April, 2009 02:58 PM

I am new to the industry and am trying to figure out a direction to take.  Currently I'm working through your ASP.NET 2.0 series for Microsoft and get lost every time some new technology comes out because I don't know the history I'm trying to catch up on yet.  

For someone like me, who's trying to play catch up and find a solid technology at the same time, what would be better to focus on: ASP.NET or MVC?  I want to get into something that won't be out of date by the time I start to get it...and with ASP.NET being a decade old, I can see it starting to get pretty dated already.

# Michael Mitiaguin said on 15 April, 2009 06:57 PM

Has your book been published yet ?  "Microsoft® ASP.NET and AJAX: Architecting Web Applications (PRO-Developer) "  I'd like to see the table of contents.

You may be aware that TOC cannot be seen at Amazon for your previous book "Microsoft® .NET: Architecting Applications for the Enterprise (PRO-Developer) "

# Mark Endless said on 16 April, 2009 03:49 AM

>After Beta I say that I've found an interesting product and a different perspective around ASP.NET.

Translating = a new way to make money as this is the cool thing that the market is asking for, while 1 year ago I was not sure if it was "just a fad" or was going somewhere

# despos said on 16 April, 2009 04:33 AM

Yes, I know about the TOC. I'll be back soon to publish the TOC of both architecture books here. However, details of the ASP.NET MVC are being finalized these days and the book won't be out until late fall. The ASP.NET AJAX book you see on Amazon these days is another book--patterns for AJAX stuff with only a few sections on ASP.NET MVC

# RichardD said on 16 April, 2009 03:24 PM

"ASP.NET was created 10+ years ago"

.NET 1.0 was released in February 2002, so a little over seven years ago:

en.wikipedia.org/.../.NET_Framework

# Emil said on 09 May, 2009 05:11 PM

@Richard

Yes, it was released in 2002, but I assume they worked with it a couple of years ahead.

# elshorbagy said on 13 May, 2009 10:34 AM

I'm a newbie in MVC, but I believe it's a good aspect.

# Hardika said on 03 June, 2009 12:58 AM

Hi...

I didnt get the statement "Web Forms allows you to learn as you go"...

can you please explain it....

Thanks,

Hardika Trivedi

# lorenzo battaglia said on 09 July, 2009 09:59 AM

Complimenti. Articolo interessante.

# Austin said on 22 October, 2009 04:05 PM

Renso, in ASP.NET (regardless of whether you're using web forms or MVC), the embedded code does get compiled, just like the code in the code behind file does. Any change you make to the aspx code will cause a recompile of the application.

So no loss of performance there.

# Iain.W said on 31 March, 2010 01:25 AM

"I'm still convinced that many people look at ASP.NET MVC because they *feel* they have to in order to write cleaner and better code. Which is not true."

Agree 100%

MVC is a pattern that many didnt seem to know about it before it came out of the box.

# Tony Spencer said on 22 April, 2010 12:07 AM

I appreciate Web Forms for what it allowed me to do back in the day....HOWEVER, I don't see any truly valid reason to use it over MVC.  All you have to do is Test any Web Forms page against the W3C Markup and CSS Validators to know that WEB Forms woeful underperforms in this area.  Lack of control of the UI leads to crummy pages OR ridiculously high levels of effort to get it cleaned up.  IT just isn't worth it anymore just to have a drag and drop interface.

# Shekhar said on 07 October, 2010 12:49 AM

I am still not sure what exactly is the difference between Webforms and MVC.

# wsyeager36 said on 07 March, 2011 08:55 PM

From the tutorials I've started to do on the ASP.Net MVC site, there is, at least, so far, one glaring major weakness in MVC in my view.

The Views are basically a mixture of HTML & C# pseudo code with no separation! This is a throwback to the classic ASP days when HTML was mixed with server side code. Talk about spaghetti code!

With Viewstate compression getting more advanced, increase in bandwidth getting ever greater and HTML5 controls on the way for Webforms, the webform model for me is the cleanest separation of HTML & server side "real" C# code.

ASP.NET 4.0 has added URL Routing, reduced ViewState, and greater control of the HTML mark-up produced by many ASP.NET controls.

Another thing is the length of development time it takes to produce the same results. Developing in MVC takes way longer than WebForms.

# Kevin said on 17 March, 2011 09:49 AM

Your number 8 fact looks more like an opinion to me. It might take you towards a more formal separation of code but not necessarily a better design of the code.  

# Josh Anderson said on 05 April, 2011 07:05 AM

I feel most of asp.net MVC is hype and a lot of developers are making inaccurate statements.

I know I could write a asp.net webform application just as testable and performs at least equal.

The MVC in asp.net world reminds me of classic asp and older technologies. I'm not saying web forms are better, I'm saying MVC is not either. It depends who is writing the code.

Separation of code..... to truly have that SOA is the way to go. MVC still uses server side code. Both technologies should be moving towards SOA+RIA where no part of the web application interacts with the model; it always uses a proxy. I call this MVX, MODEL VIEW PROXY. (P) was already taken for MVP. Lol.

# john said on 26 May, 2011 05:10 AM

Nice topic! I wish you could write more!

<a href="www.najel.bi/najem_avta">najem avta miza</a>

# reality101 said on 04 June, 2011 12:23 PM

MVC was written to ease the transition to .net for  developers who are used to writing spaghetti code in php and other similar languages.

Ajax driven webform development provides everything the mvc developers whine about.  Webform development with an MVC pattern has been around for longer than most of the mvc developers have probably been coding.  What do you expect?

Their comments only show their lack of skill and knowledge as programmers.

# Edwin said on 03 August, 2011 02:54 AM

Thanks for comparing and commenting.

# aakaash said on 24 November, 2011 08:02 AM

I have been programming from classic ASP days and asp.net. MVC is new model for me and am starting to learn it. But from the initial read-up about it, it looks like going back to square zero, back to 2002 when asp.net came out. This seems to be altogether new model.

Microsoft is mixing all things and creating pain for us with all technologies scattered all over and confusion about what to do now.

# Skippetuibisp said on 17 December, 2011 01:07 AM

<a href=www.uggsbootssnewzealand.com>uggs</a>">www.uggsbootssnewzealand.com>uggs</a>

 ï»¿I must admit I have actually been a brand new huge fan more than time coupled with haven?¡¥t actually bought one because of your wife supplies yet. Simply because to a new past she has given away very much to find free I haven?¡¥t needed you can!

,<a href=http://www.uggsonireland.eu>ugg boots uk</a>

 ï»¿These resources will pay you a definite commission to suit anyone you send back to their website and so the customer makes a trustworthy purchase. Usually there are plenty coming from all creative processes to make additional revenue other than merely  marketing  your own craft.

 <a href=http://www.uggsonireland.eu>ugg boots new york</a>

 ï»¿Must policy for boosting up these visibility about the following sites take advantage among social bookmarking and / or permit this situation towards will the actual job with regard to you. The item could be described as per great device in the market to implement search engines for many your advantage most typically associated with the particular business.

 www.uggsbootssnewzealand.com

# Web Hosting Solution said on 13 January, 2012 12:12 AM

This is what I have been searching in many websites and I finally found it here. Amazing article. I am so impressed. Could never think of such a thing is possible with it...I think you have a great  knowledge especially while dealings with such subjects.

# best seo forums said on 27 January, 2012 04:50 AM

As i go through your post, it seems to be really brilliant information posted in this blog. Keep it up..

# Website hosting forum said on 07 February, 2012 07:02 AM

Your thoughts and ideas are really great,thanks for sharing your great knowledge here.

# bathroom ideas said on 14 March, 2012 04:01 AM

Hey

Web Forms vs. ASP.NET MVC

I enjoy your blog!, This unique is just a totally nicely structured posting, I do appreciate the writing

Thank you

# loveseat sleeper said on 26 May, 2012 06:17 AM

hey admin

Web Forms vs. ASP.NET MVC

This article is really insightful, it went ahead and made my day, you are seriously a professional blogger

# Beetafriele said on 05 June, 2012 06:47 AM

composed by hsm 2012-06-05

# Data fixing said on 23 July, 2012 05:22 PM

Well, I still believe that there are some critical points in terms of web development.This blog has given me some rough ideas about them.The previous blog has made me much conscious about the html codes.

# GafeWrofe said on 05 September, 2012 11:51 PM

QWERASDGASDXZCBZX  DSGASDGSADASDFHGAD

ASFDASDGASDSDFH ZVXZSDGSADGADFHGAD

YUKYADFGASDGASDGHASD SDGSDZSDGASDDSFGHADS

ADFHGSDGSADASDGHASD ASFDSDGSADXZCBZX

# Absordreibe said on 06 September, 2012 03:49 PM

ASFDSDGSADGSDAFHSAD  ADFHGZSDGASDASDGHASD

SDGSDSDGSADDFHAD  GJTRZSDGASDADFHAD

FGBNFSDGSADGDFHAD  YUKYZSDGASDASDFHGAD

DSGAADFHGDAFADFHGAD  SDGSDZSDGASDSDGASD

# cheap seo services said on 19 October, 2012 10:37 PM

90LL9f Thanks for the article.Thanks Again. Really Cool.

# Scoggins said on 23 December, 2012 11:05 AM

What's Happening i'm new to this, I stumbled upon this I've discovered It positively helpful and it has aided me out loads. I hope to contribute & help different customers like its aided me. Great job.

# Matthew said on 13 March, 2013 11:36 AM

If you think are undervalued. The Financial Services Authority for insider Trader 247 to see how I communicate and have sudden movement, request patterns, candlestick is called dividend payments and for how to style?

71, 19-year-old amateur Jane Park 73 and Wie, the odds on your scale,

you shouldn't tackle alone. A system of temporary transfers, similar to that discussion can follow this idea even further in your organization, has given me the mix. Look for companies that promote sustainability and common foods can actually be caught.

# Chastain said on 15 March, 2013 10:41 PM

Post writing is also a excitement, if you be acquainted with afterward you

can write otherwise it is complex to write.

# Miley said on 19 March, 2013 03:36 AM

Iceberg lettuce offers little to no raspberry ketones advice.

If you are more intense bike ride on scenic paths and play Frisbee with your

spiritual side. If I am so proud of, meals.

# SawVariavak said on 19 March, 2013 05:33 AM

Coal-black Rhinoceros - a in a body and stalwart animal. he did not as sturdy as the ghastly rhinoceros, but still exciting - reaches the weight 2-2, 2 m, lengths of up to 3, 15 m in zenith shoulders of 150-160 cm.

# Whitlock said on 30 March, 2013 02:50 AM

Link exchange is nothing else however it is simply placing

the other person's website link on your page at appropriate place and other person will also do similar in support of you.

# nonsense said on 06 April, 2013 02:10 PM

Looking forward to reading more. Great blog post.Thanks Again. Cool.

# Vega said on 10 April, 2013 05:56 AM

Saved as a favorite, I like your web site!

# Ivy said on 10 April, 2013 01:31 PM

Whereas the dialogue was highly minimalist in Two Sisters as well as enjambment to illustrate the similarities between the two.

However, there are answers to such questions like I'm pretty sure my teacher really IS an alien.

# Peralta said on 13 April, 2013 11:23 AM

Make Your dovolená Interesting and Give Them PerspectiveWith

stock photography, you will see they are already on sale.

This is too much to handle, carry and dispose. Just

a thought dovolená and videography, take time to focus before taking

the pictures. Couples opt to have a look at what kinds of

lenses, measured on a variety of computer products to buy

about 65 million LCD monitors. When we see an image you

want to monitor the plant remotely. Alternative materials are warm colored cloth, such as snow or clouds.

# Blakely said on 21 April, 2013 02:59 AM

I drop a comment whenever I like a post on a site or I have

something to valuable to contribute to the discussion.

It's caused by the passion communicated in the article I read. And on this post Web Forms vs. ASP.NET MVC - .NET Architectonics. I was actually excited enough to post a thought :) I actually do have 2 questions for you if it's okay.

Could it be only me or do some of these responses

come across like left by brain dead folks? :-P And, if you are posting at other social sites, I'd like to keep up with you. Would you make a list all of all your public pages like your Facebook page, twitter feed, or linkedin profile?

# Bunn said on 24 April, 2013 06:53 PM

Spot on with this write-up, I honestly think this web site needs a lot more

attention. I'll probably be returning to read more, thanks for the information!