ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Posted Mon, Feb 4 2008 11:13 PM by Mischa Kroon

Introduction

What is MVC

MVC stands for:

Model (database)
Controller (business logic)
View (what you see + view logic)

It is used to separate the logic from a web application and other types of applications into these 3 logical parts.

There are a lot of people who think this makes development easier and more maintainable. For more information on MVC click here.

What is Ruby On Rails

Ruby On Rails, ROR for short is the framework which took the world by storm.
Or it just caused a storm, one or the other, but I guess it made the whole MVC idea a whole lot more famous.

Ruby is the language on which this framework is built, the characteristics of Ruby as it stands now is that the language is very powerful and expressive but runs pretty slow

What is ASP.NET (Webforms)

ASP.NET is currently set up in a way that it tries to mimic windows programming as much as possible.

This means that it is event driven and supports concepts which make it more like a statefull windows program.

This means that you can for instance drag a button on a webform and double click this button to add an action to it.

Double click the form, to type in an action which is done when the page is loaded.

This means that this form of programming is a form of event driven programming.

What is ASP.NET MVC

ASP.NET MVC is the Microsoft implementation of MVC.

It does away with the event driven programming and it doesn't try to be statefull. With these choices it gains a few things and loses a few others.

Differences Between them in a feature chart

I think the best way to highlight some of the differences between the platforms is to highlight these difference in some charts. So without further ado let's have a look at the differences:

Webforms vs MVC

  Webforms MVC
URL's through pagenames / URL rewriting.

Standard:
pagename.aspx
through routing
programmaticly set up the url's by default this works through REST like interfaces.

Standard: controller/action/param
Event driven Yes No
Statefull Yes (Viewstate) No
Easily unit tested No Yes
Easily View tested same same
Can use designer easily Yes No (I think)
Double Click to get action Yes No
Different view engines supported No Yes
Support AJAX easily Yes Yes
Support ASP.NET Request / Response objects Yes Yes
Supports Dynamic Languages Yes Yes
Can play well with the other Yes Yes
Abstraction from html Yes No
Exact control over html No Yes
Support ORM Yes Yes
Will be able to use library of third party controls for ASP.NET Yes Partial (no state / postback controls only)
Works on Linux / Mono Yes (Partial) No

 

ASP.NET MVC vs Ruby On Rails

  ASP.NET MVC Rails
Compiled Yes No
Intellisence Mostly Depending on editor
Has free IDE Yes Yes
Can be easily deployed on shared hosting Yes not really
Can be easily deployed on windows Yes No
Can be deployed on Linux No (Maybe if mono picks it up) Yes
Has a built in ORM No (not yet) Yes
Has out of the box for multiple Databases No Yes
Is resource efficient Yes No
Extensive caching options Yes Yes
All URL available Yes Yes
REST possible Yes Yes
.Net Framework available Yes No
Ruby Runtime available Through interop / CLR implementations Yes
Has an active community around it Yes Yes

 

I'm missing feature X from this chart

Could be, it's not a complete list of features.

It's just a list of things which seemed nice to compare if you want you can always comment about your favorite pet difference between one of these frameworks / development methods.

Generalisations / when to use which option

The charts above will mostly tell you when you can't use one of the options in the list.

All the platforms will keep evolving but each has it's own strengths and weaknesses at the moment. 

ROR is great for when your working on a non windows platform and want to write as few lines as possible and want to work in Ruby.

Webforms is great for when you want quick results with nice building blocks from 3rd party developers and you don't need exact control over your html.

ASP.NET MVC is great for when you want complete control over your html and url's and want unit testing like there is no tomorrow.

Personal preference

My webdevelopment method of choice for now remains to be Webforms this is mainly because of a lot of nice development speed enhancements which are present in this platform.

It's something which makes the easy things pretty fast to do and makes the harder things quite hard and complicated.

I might be going over to some other platform / framework based on what lies ahead in terms of websites / applications to create.

Only time will tell, but for now I remain satisfied with Webforms for a RAD platform.

But what about testing ?

There are a lot of people who like setting up unit tests along with their regular development.

I think my opinion on this is a subject for a whole other posting so I won't go into it any further at this time :)

Conclusion

We are living in a golden age for Internet development there are a lot of options in the web development world, and the possibility's are still growing and evolving at a brake neck pace.

All the choices above will probably be used to amaze us with things that are possible and all will probably still have a place in developers hearts for quite some years to come.

The question is what will the new players bring 5 years from now, and how will these technologies stand up to each other then.

Comments

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Wednesday, March 26, 2008 3:25 PM by pete w

Frankly I am floored that you prefer web forms over rails/monorail/mvc.net.

I've switched most of my projects over to the MVC side and mocking, unit testing, page routing is so much easier its not even funny.

The web form page lifecycle from contruction to oninit to viewstate and postback makes it needlessly complex and near impossible to unit test.

Viewstate garbage gets injected into the source code of every rendered html page... I've seen pages with a size of 2+ megs full of viewstate that gets juggled between the client and server.

Data driven AJAX makes the problem even worse.

I could go on, but mark my words, web forms are on their way out.

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Tuesday, April 08, 2008 1:33 PM by Tom

@pete w

Viewstate can be easily turned off. It gets quite large with editable grids and similar controls, but, if you don't need them, just turn the viewstate off, and that's it. It can be trimmed to just a few bytes. In fact, I believe that it can be completely avoided if you don't use form runat='server'. In this case you are limited only to HTML controls with runat='server' and just a few others. But, that's what you get with MVC anyway.

As for ORM... I really don't think that ORM should be a part of a MVC framework. I didn't try ASP.NET MVC, but I'm quite certain that NHibernate, ActiveRecord (from the Castle project) or LINQ work quite well. I'd say that this is an advantage over RoR.

# The ASP.NET MVC Information Portal

Saturday, June 14, 2008 8:31 PM by The ASP.NET MVC Information Portal

Pingback from  The ASP.NET MVC Information Portal

# ASP.NET MVC Archived Buzz, Page 1

Thursday, July 03, 2008 2:05 AM by ASP.NET MVC Archived Buzz, Page 1

Pingback from  ASP.NET MVC Archived Buzz, Page 1

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Friday, October 24, 2008 8:31 AM by jack

With all this MVC stuff do people still practise their OOP skills anymore? :-)

Anyway OOP is being abstracted to a higher level now ... namely MVC and component based software.

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Wednesday, December 10, 2008 2:31 PM by rvr

IronRuby is able to run Rails on Windows, so I think the answers to "Can be easily deployed on windows" and ".Net Framework available" should be Yes.

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Wednesday, December 10, 2008 3:21 PM by Mischa Kroon

Ironruby doesn't have full rails support to my knowledge, now you could say it can be easily deployed on windows with mod_passenger on apache, but I really haven't tried that yet so can't comment on it.

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Tuesday, December 16, 2008 2:03 PM by Sosh

Also very suprised you prefer WebForms.  I've always thought of them as very messy and I'm glad that we can keep some of the great things about ASP.NET (C# for instance!) without rubbish like the postback paradigm, viewstate and all the other junk.

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Wednesday, January 07, 2009 9:33 AM by bnaidu

Hi,

Can you update the differences of .NET MVC and RoR MVC ?

For following points,

Can be easily deployed on windows...

Now RoR can be deployed on Windows as well with Apache or Mongrel win32 service.

Thanks,

bnaidu

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Monday, January 19, 2009 9:32 PM by Jeff Ancel

Interesting.  I would not ever prefer Forms type development.  That is an abstraction that I prefer to maintain proper control over.  I prefer  .Net MVC, I would not have gone ROR or Forms though I may have chosen Java and become an XML king I guess.  Thank goodness MVC is here, lovin it.  Sure things are a little harder in the beginning, but in the end I have 100% control over what is going on in my applications and that I love.

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Wednesday, March 04, 2009 11:17 PM by brian

ehhh, if you're developing web applications correctly, you're probably gonna want better control over your html than web forms allows. you should seriously look into this, and the benefits it can provide as far as accessibility and performance.  there are standards compliant adapters for web controls, but i'm not sure how those give you in the designer.

the bad thing about webforms development process being so close to that of window forms, is that you're not developing a desktop application using webforms. trying to give state to the web obviously goes against the flow here, and you have webforms for a rad solution. i'm not hearing anyone talk about the benifits of rad anymore and more so on the quality.

i geuss you could say it comes down a bit here to quality or quantity. mvc frameworks typicly giving you more output quality control, and webforms just supporting rad and a "i don't care what's being  generated here" mentality that really is questionable. plus i hate postbacks. i've always thought it was a bad concept.

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Friday, March 20, 2009 8:31 PM by Jon

I'm curious what you do in ASP.NET MVC if you need something like a TreeView control? Implement it yourself from the ground up? You may as well go back to writing CGI scripts.

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Friday, March 27, 2009 7:17 PM by Dogtown

@Jon

Use a javascript treeview like normal people ;-).  In asp.net 2.0, the included treeview wasn't even compatible with update panels.   If you are a UI wiz, you WILL find yourself fighting against asp .net web forms.  Once MVC.net develops a stronger community, finding boiler plate code for treeviews or other client interactions (based on jquery lib) will be easy.

I don't believe in 2-3 years we will be discussing web forms much, as most of the trailblazers at MS have moved on: scott hanselman, phil haack, scott gu.  I think silverlight will merge the winforms(wpf)/webforms experience at the client level, replacing the need for RAD web forms.  IMHO, we are now watching the slow death march of web forms.

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Thursday, April 09, 2009 12:29 AM by Brian Hogan

I wrote the chapter on Windows deployment for "Deploying Rails Applications" (pragprog.com/.../deploying-rails-applications). It's easy to deploy on Windows with Apache behind IIS.

Since March of 2008, it's ridiculously easy to deploy to shared hosts thanks to Passenger which more hosts are using. Many developers are having excellent luck with Dreamhost now, whereas before it was quite painful.

I just wanted to clarify those two points, and also to tell you that I found the rest of this article quite useful. Thank you.

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Friday, June 26, 2009 12:24 AM by Dave

Model (database)

- no, Model is the OO representation of your business entities, including the data that defines them. to say 'database' gives the wrong impression. Database is just a repository to store relational data.

Controller (business logic)

- no, Controller is the intermediary between your Model and your View. Controller is the manager which determines what goes on in your website, but the business logic is the definition of what the system is about.

View (what you see + view logic)

- absolutely.

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Friday, March 12, 2010 9:03 AM by mvc

if you need a tree view in asp.net mvc you can use jquery. For example this jquery.bassistance.de/.../demo =)

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Wednesday, May 19, 2010 11:22 PM by trobinson

Some of the answers for the aps.net vs RoR MVC has changed and or was innacurate in the first place...  on the asp.net mvc side the answers should be the following:

Can be deployed on Linux: Yes (using Mono 2.6)

Has a built in ORM: Yes  (Using Entity Framework 4)

Has out of the box for multiple Databases:  Yes

For the last one, asp.net mvc has always had support for multiple databases...  via dblinq or EF or plain old ado.net

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Saturday, March 05, 2011 5:43 AM by Bartek

In my opinion, the question is becoming blurred with a lot of the cool features of MVC making their way into Webforms.  ASP.NET 4.0 added URL Routing, reduced ViewState, and greater control of the HTML mark-up produced by many ASP.NET controls, now the new version incorporates many more MVC features into Webforms.  http://bit.ly/dNhBd8

# re: ASP.NET MVC vs ASP.NET(Webforms) vs Ruby On Rails

Thursday, July 19, 2012 9:35 PM by Lelala

Thanks for that summary in your article, it gives a good overview for beginners :-)

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 3 and 7 and type the answer here: