views:

880

answers:

11

Are there any obvious productivity gains in developing using webforms or MVC?

+6  A: 

No. Personally, I find MVC works much more like my brain does with pretty clear separation of what goes where and why. I banged out a complete prototype commerce site with MVC in a few weeks that would've taken me, I'm sure, at least double that using webforms.

brad
"MVC works much more like my brain does with pretty clear separation of what goes where and why" - I second that, I chunked out code wayy faster almost immediately after 'grogging' MVC.
chakrit
@chakrit - I think you mean 'grokking' - http://en.wikipedia.org/wiki/Grok
Richard Szalay
+5  A: 

At this point, WebForms, is more mature. I wish, for example, that validation (client and server side) had better support in MVC. However, I fully expect that, over time, this will improve. The best thing about MVC from my perspective is that MVC makes my code much more testable. I was leaving a lot of code untested with WebForms simply because it was too difficult to test the codebehind. Now I can write unit tests for all my controller logic.

Even if it eventually turns out that MVC is somewhat slower (and I'm guessing that it won't be), enhanced testability would make it worth it. Eventually I will recoup that time, since there will be less going back and fixing buggy, untested code later.

tvanfosson
it is suppose to be faster!
+7  A: 

With MVC, you never spend time trying to work out why ItemDataBound and ItemCommand aren't firing when you expect them to.

If you think that'll save you time, then MVC is probably for you.

Dylan Beattie
so true, it hurts.
chakrit
I hear you. WebForms seems quick when you can just drop a grid or control of some sort on a form and hook it up to a datasource. But when you are debugging events and chasing your tail it soon becomes painful.
Craig
+2  A: 

I find MVC a much more natural fit for web development. As the previous poster has noted, you'll undoubtedly save time by not having to deal with weird bugs thrown up by the web forms page execution lifecyle.

Also, the ability to write unit tests for your logic much more quickly (and with a lot less of a reliance on mocks!) is a great advantage.

Finally, I've found that it's a lot easier to write css and client script when using the MVC framework as you are able to specify your own IDs on HTML elements.

A: 

It depends on how you develop.

If you're someone who drags controls onto the designer surface, it would probably be hard to ever match that level of rapid development with MVC.

On the other hand, if you spend most of your time in source view, you'll probably find that MVC allows you to do so more efficiently.

Bringing AJAX into the picture, if you're someone who relies on the UpdatePanel, MVC would probably be unspeakably miserable for you.

(This doesn't begin to address the subjective issue of which type of development is more "correct". I don't believe that's the point of this question though.)

Dave Ward
+1  A: 

I think eventually MVC will be the clear winner for Web Developers. However ASP.Net will retain a very important role because there will always be .NET guys that consider themselves web developers who are really .NET winform guys. ASP.NET sans MVC lets you throw stuff together really quickly, but you can easily end up with horrible, terrible, unholy HTML, CSS and javascript. MVC opens the door for wonderfulness but requires a more disciplined approach by developers.

Terry Donaghe
You should clarify you mean ASP.NET webforms. MVC is also built on the ASP.NET stack
Jace Rhea
+2  A: 

When I hear the term "rapid development", I find that people typically use it in the context of "how fast can I develop a new solution". There are a lot of factors that must be considered before a reasonable answer can be constructed.

  • How familiar is the developer with the framework?
  • How comprehensive is the design?
  • How complex are the requirements?
  • How stable is the framework?

I first came in contact with ASP.NET MVC shortly before 1.0 was released. Prior to that, I was very familiar and very comfortable with ASP.NET WebForms, but I was still frustrated with the development process as a whole. I was aware of the goals surrounding separation of concerns, and knew enough that clear separation wasn't possible with WebForms without swimming against the current created by the framework.

Since working with ASP.NET MVC, I found very quickly that I was missing the boat on a number of things. While WebForms allows you to build things "faster", you are basically held hostage by Microsoft's implementation rather than allowing you to more easily digest established standards (such as JavaScript, CSS and AJAX) in environments that don't involve Microsoft. Also, the creation of new tools, behaviors and functionality should not be motivated by sales and profitability, but because the technological demands of the developer community require it. I've been working on this current MVC project since April. I enjoy working with this framework very much, and would recommend it highly to anyone and everyone interested in moving away from WebForms. Learning the framework takes a bit of time, but once you understand it, you literally wonder why you couldn't have done things this way from the beginning.

You can build applications faster with WebForms, but, if you want professional looking websites, you will have to invest in component libraries that will still require you to learn those established standards in order to leverage them properly. If my 11-year-old son expressed interest in learning web development tomorrow, given the choice of WebForms or MVC, my choice would be MVC. That being said, I would still direct him towards learning JavaScript, jQuery and AJAX before he even touched MVC, because understanding those frameworks makes understanding almost every other that much easier.

Personally, I am not an advocate of "rapid development". I have spent my career as a corporate developer, and view in-house development as an investment. I would prefer spending 20% more time in design and development instead of shorting the project by 20% just to meet an unrealistic deadline. Each dollar "saved" during initial development will easily cost you at least $1.50 due to maintenance costs, re-education, and architectural changes due to new requirements. But, not everyone thinks as I do, so...my simple answer would be MVC.

Neil T.
A: 

When it comes to the first 90% of development, WebForms is the clear winner. It's that last 10% that's the problem and where MVC has the advantage.

Dan Diplo
..where the last 10% takes the other 90% of your time.
Jace Rhea
+2  A: 

When you are dealing with productivity of ASP.NET MVC vs. ASP.NET Web Forms, consider these two developers.

  1. Generic .NET Developer who has extensive experience writing WinForms and WebForms applications.
  2. Generic Web Application Developer who can write C# code, but knows HTML, CSS and jQuery/MooTools/etc like the back of their hand.

The Generic .NET Developer will be most efficient at writing code in the original ASP.NET Web Forms. This is because they know the event models very well (as they are mirrored between WinForms and WebForms) and will be able to quickly build a website using this mental model.

  • MVC would have a large learning curve because it is a complete departure from his existing knowledge of "How the web works". These are the stumbling blocks this developer will find with MVC:
    • Having to learn HTML and CSS to a point where they understand what is going on and how things interact with each other.
    • Learning javascript and how to call back to the server for ajax.
    • Figure out how to maintain state, finding out cookies are not secure and that session has certain 'gotchas'.

The Generic Web Application Developer will be most efficient in ASP.NET MVC because the framework mirrors how they think of web applications - there are no events, no application state, etc. They already know how to write good HTML and style it using CSS, they know how to write an ajax call back to the server.

  • Web Forms is not a good model for this developer because it is a departure from his existing knowledge of "How the web works". These are the stumbling blocks this developer will find with ASP.NET Web Forms:
    • Time will have to be spent trying to figure out how the Page Lifecycle works.
    • ViewState will cause many problems, cause the page to bloat.
    • A lot of HttpRequest hacking usually will have to take place to fix all the bad code that comes out of certain WebForm Controls.
    • Learning how to deal with AJAX callbacks instead of just using their existing knowledge of how to call a URL from jQuery.

My main point is that different developers will have different levels of productivity based on their previous experience with web development. I personally prefer ASP.NET MVC, I can build something out very quickly and have it output exactly what I intend.

I am the #2 kind of developer, I have written web applications (most of them small) in Ruby on Rails, Django, ASP.NET Web Forms and ASP.NET MVC. The knowledge of web development between these 3 frameworks is almost interchangeable (with exception to having to know the hosting language - ruby vs. python vs. c#).

The most infuriating thing I find with ASP.NET Web Forms is that it tries to do too many things for the developer (things like application state, web events), the code output often does not play well with Web Standards, Web Forms 2.0 is tied directly to XHTML 1.0 Transitional. Anything that is beyond a quick and dirty DataGrid and Form to CRUD rows in a database usually causes more pain and suffering compared to writing it in ASP.NET MVC.

Redbeard 0x0A
A: 

WOW. I've been using ASP.NET controls for almost 5 years and now i hear about this new kid on the block - MVC

I guess MVC was created for php developers to cross over. I cant see any other MAJOR reason for doing so. But, i dont know MVC so dont listen to me. THats just me making a guess.

I'm pretty fast at ASP.NET ASP.NET forms and data binding. When i leanr MVC i'll come back and make a comment

DonP
"When i leanr MVC i'll come back and make a comment". But you did...
Jace Rhea
Yeah, and after learning how MVC works i'd be out of my mind to leave Winforms for MVC. The unconventional tricks we do in webforms is not replicable in MVC without TONS of code.MVC = tons of code
DonP
A: 

I've tried both. I'll give you the perspective of someone who has started learning both about the same time. I think WebForms wins hands down for RAD, and is much easier to learn. There is less coding to do, too. You can drag controls in, rather than building pages in HTML, and then coding in the linkages. If you want something like a grid, you just drag it in with WebForms.

MVC seems complicated to me. I see the value on projects that require that the site look exactly a certain way, though. It also is easier to debug, with it's separation of code. I'm hoping Microsoft streamlines MVC in the future. I see the potential, but it doesn't seem like it is there yet.

As far as trying to make money with ASP.NET, for most people I'd recommend WebForms.

Michael