Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
The ASP.NET MVC Definition

image A few days ago I posted a question to the community, looking for a definition of the ASP.NET MVC framework that didn't depend upon faults in ASP.NET WebForms - after all, faults can be fixed.  I also do not like the implication that ASP.NET MVC is for those looking to use the MVC pattern, as I've been using that pattern for a decade and I use it in WebForms today.  Credit goes to Lucas Goodwin for helping me with the following definition:

ASP.NET MVC is the evolution of Classic ASP.

I've helped a number of developers move from Classic ASP to ASP.NET, and each one has said to me, "wow, this is nothing like ASP" once they groked it.  This is true, and mostly because WebForms introduced an event based paradigm to ASP.  Classic ASP had problems, but was the lack of events one of them?

Classic ASP's number one problem was lack of separation of concerns.  This is the same reason I don't like PHP, my code is far to friendly with my HTML (gotta keep em' separated).  True you can discipline yourself to provide a separation, but it's not something the framework designers gave much thought to.

WebForms fixed the separation issue, but at the same time brought in the event model.  I liked this "magic controller" approach, because it saves me the time I used to spend wiring up controllers that just ended up back at the same template I started with.  (For the record, I was mostly working with python before moving to WebForms, first with a framework called Albatross and later SnakeSkin)  An event model is not required to have separation of concerns, and this forced an event model on to many Classic ASP developers.  So I will add a bit to the definition:

ASP.NET MVC is the evolution of Classic ASP, adding an easier separation of concerns while not using an event based model like WebForms.

So do you agree or disagree?  I like this definition because it's not claiming either approach is better, and I can look to the pros and cons of an event based model to guide me in selecting MVC or WebForms for a project.  It also is less likely to cause rioting in the streets at your next user group meeting when the topic comes up!


Posted 07-26-2008 12:35 PM by Michael C. Neel
Filed under: , ,

[Advertisement]

Comments

Chad Myers wrote re: The ASP.NET MVC Definition
on 07-26-2008 1:29 PM

Very much agree.

Perhaps a different way of saying its: "ASP.NET MVC was built for building web applications."   ASP.NET WebForms was built to make it easier for VB6 Data Forms developers move to the web and so made web development, in general, more complicated. It wasn't totally worthless, there were some very interesting/nifty things, but overall it added constraints that became cumbersome down the road.

ASP.NET's core is where most of the value is and it's good that you can get all/most of that functionality without having to use the runat="server" stuff too much! :)

Bill Barry wrote re: The ASP.NET MVC Definition
on 07-26-2008 2:35 PM

Perhaps it would be better if they dropped the ASP.NET connotation altogether. That way there wouldn't be confusion.

More:

16randombytes.blogspot.com/.../aspnet-mvc-branding.html

Who and What is ASP.NET MVC for? « If only I were . . . wrote Who and What is ASP.NET MVC for? « If only I were . . .
on 07-26-2008 5:42 PM

Pingback from  Who and What is ASP.NET MVC for? « If only I were . . .

Brian Johnston wrote re: The ASP.NET MVC Definition
on 07-26-2008 9:39 PM

@Chad

Personally, I've found web developement is significantly easier with web forms.  When they introduced ASP.NET (and I was a ASP developer at the time) I was giddy with excitement and it took very little time to transition - in fact I ran without ever looking back at ASP.NET.   But maybe that's because I transitioned during a time where you had to get stuff out quicker and classic ASP and it's late bound loose typing made that very hard.  And making scalable enterprise applications - in comparison ASP.NET is a walk in the park.

But each person has a different story of their past, so we can both argue that point until we're blue in the face.

So, for me, if I'm in a position to higher someone or make a reference, I can recommend hiring a developer with less, or even significantly less to no experience in web development, if we were going the web application route than I would have to with ASP.NET MVC and save the company money.  (And most companies are out to make money, not write software, something most people in ITS tend to forget).

Take for instance, because of your very statement about VB6 developers, core knowledge:  I can hire someone who only has Windows development (at maybe 10-15% less since they don't have web experience) than someone who has 'true' web development (as you infer) for a project using a Web Application - I can't do that as easily if it's an ASP.NET MVC application.  I can do it safely with the Web Application because the Windows developer is already familiar with the event/delegate model.  He drags and drops all his controls onto a designer and uses master pages.  He doesn't need to know HTML, CSS, or W3C standards - if he gets in a bind that's why I'm there.  Because I'm not going to higher a developer (windows or web), that puts any business logic in the code behind, the only part of our application that will be so-called untestable is the rendering of the HTML.  However, I guarantee I can write a web application with just as much code coverage, if not more, than a ASP.NET MVC application - any takers?  Consequently, having this type of developer works out well for the business because we can put this guy to work on desktop applications too.

Now on the other hand, I have an web developer who knows XHTML strict, tranistional, CSS, JavaScript, etc.  His 'web applications' do the same thing that the other guys does, but he can't work on a desktop application because he doesn't understand the event delegate model very well and only understands MVC - he's a trick dog.  He also is more prone to spend longer on a project because he too worried about using div tags instead of table tags and whether or not he should have a label element or a span element.  I know this because I once was solely a web developer and this is use to be one of my faults, and I've seen it in my associates who are old school web developers - but a windows developer - he lets the control do the work.

From the business stand-point, web applications, and web application developers are a better use of your budget - they (the developer) can fill multiple roles and they're not as likely to waste time optimizing HTML.  And again, your business is there to make money, not web pages, so they want something as fast as possible anyway - in fact they rather just lay you all off and by something from a Vendor (the people who do get paid to write software for a living) if they could find the right product with the right support.

What I find particularly interesting about this whole MVC minefiled - I saw a video of Scott Gu on ASP.NET MVC - and what amazes me is all the reasons he promotes it, are the EXACT reasons that were listed as problems that ASP.NET web applications were promoted as fixing and being such a huge leap forward for web development.

We are at war with Eurasia, we have always been at war with Eurasia.

ASP.NET MVC Archived Blog Posts, Page 1 wrote ASP.NET MVC Archived Blog Posts, Page 1
on 07-27-2008 1:51 AM

Pingback from  ASP.NET MVC Archived Blog Posts, Page 1

Dew Drop - July 27, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop - July 27, 2008 | Alvin Ashcraft's Morning Dew
on 07-27-2008 9:11 AM

Pingback from  Dew Drop - July 27, 2008 | Alvin Ashcraft's Morning Dew

Michael C. Neel wrote re: The ASP.NET MVC Definition
on 07-27-2008 11:34 AM

@Chad That implies that those using WebForms do such because they do not understand the web or how to build "real" applications and is the reason this is such a heated topic.  Someone can be an expert in XHTML, JavaScript, CSS, etc and still choose WebForms.

@Bill I like your idea of "WebViews and WebForms", would be nice it it caught on!

@Brian Part of this feels like a case of business versus academics - and I don't think these two groups will ever agree, but I do see now that WebForms doesn't work for the academics and hopefully MVC will (if not, they are left with going Ruby or Java!).  

Robin Clowers wrote re: The ASP.NET MVC Definition
on 07-29-2008 1:48 PM

@Bill I don't think that makes sense because MS MVC still uses the very flexible and powerful ASP.NET execution engine, just not the page lifecycle.

@Michael I don't agree with the idea that you do MVC in webforms.  A controller should not know anything about the UI; the code behind has references to all the controls on your page!  Also, how can you test the code behind without running asp.net?

Michael C. Neel wrote re: The ASP.NET MVC Definition
on 07-29-2008 3:05 PM

@Robin Check out the provider model in webforms, this is pretty much textbook MVC.  There is also nothing in MVC that says the controller can't know about a view or even that a view can't know about a model - only a model is ignorant of the rest.  

Events in webforms do allow DI - every event method takes a sender as a paramter that can be moc'd in testing.  If you write your event methods ignoring this then you're not writing testable code.  The aspx and code behind are compiled into a class like any other.  Check out my previous post for more on my views about testing as well.

This is also using your assertion that the code behind is a controller (it can be of course), but the controller can just as easily be another class connected to the view through an ObjectDataSource and in this case, the controller would not need any knowledge of the view.

Last, the point here is if ASP.NET MVC is defined as a testable framework and it's asserted that Webforms is not, then the value of ASP.NET MVC is lost in debates of TDD and code coverage, and I don't want to see that happen.

The ASP.NET MVC Definition « Payed Coder wrote The ASP.NET MVC Definition « Payed Coder
on 12-13-2008 10:45 AM

Pingback from  The ASP.NET MVC Definition  « Payed Coder

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)