views:

303

answers:

9
+3  Q: 

MVC for me?

I'm currently learning "traditional" ASP.NET, but then there is a lot of buzz around ASP.NET MVC. Should I get into MVC now, or get a good understanding of the trad webforms first?

+5  A: 

If you haven't learnt ASP.NET Webforms yet, you have to ask yourself whether you really want to learn about web development.

ASP.NET MVC exposes you to the joy/pain/beauty/ugliness of HTML, Javascript and CSS. ASP.NET Webforms attempts to hide you from all of this as much as possible.

Personally, I'd rather know everything that's happening in my applications, even if that sometimes means more work which is what makes me prefer ASP.NET MVC.

Garry Shutler
I'd agree that some abstraction from the underlying plumbing is a good thing, but giving up control or leaving bloated and/or unaccessible sites isn't an option..
tplive
+12  A: 

Get into MVC. Now. And never look back.

Razzie
+2  A: 

This is a pretty good article which might help you decide: http://weblogs.asp.net/shijuvarghese/archive/2008/07/09/asp-net-mvc-vs-asp-net-web-form.aspx

Really though it depends what you want to do although MVC is looking like it'll be the way forward.

Fermin
+2  A: 

I'd say dive head-first into ASP.NET MVC. You won't need to learn the WebForms details to understand it, and you'll avoid developing a lot of possibly bad habits. MVC is much better about encouraging cleaner coding and highlighting pain points in your applications.

John Feminella
+2  A: 

If you are just starting with WebForms and are thinking of doing MVC instead, I would just make the leap. Learning WebForms at this point won't really help you and may confuse you with respect to MVC. It's a completely different model of development even though it uses the same framework.

tvanfosson
Agreed - plus MVC will allow him to better understand frameworks like Spring and RoR for the future (while webforms doesn't really seem to relate to anything else).
Jess
+1  A: 

Have at look at this previous post for some features and benefits over Web forms.

Having been using Web Forms for a while now I would recommend trying out MVC, its a good framework and simpler to use than it seems at first!

Rigobert Song
+2  A: 

I started learning ASP.NET webforms last year. Now I'm immersed in an MVC development effort. I've got to say I appreciate having more control and knowledge of what is going on. I don't know how much time was spent trying to figure out what webforms logic was doing behind the scenes. With MVC you start with a better concept of programming by learning about separation of concerns early.

malckier
+1  A: 

I'd recommend starting on MVC. Webforms is arguably a hack - trying to make the web programmable using the same eventing model as winforms. You'll probagbly spend a signifcant amount of time trying to grok that hack. MVC benefits from a clean separation of concerns, is far easier to test, and encourages better architectures.

What you'll lose (at least for now) is the ability to "drag and drop" a huge array of commercial asp.net components, and the designer shortcuts that Visual Studio might give you. Since it's so new, you may also be limiting your job prospects (although you'll probably gain a better core understanding of how the web works).

But put it this way, I've been on MVC for about a year, and the idea of going back to webforms sends chills down my spine.

Nik
+2  A: 

Having started on asp.net webforms and shifted to asp.net mvc I can comfortably say I much prefer asp.net mvc. Some people will prefer webforms whilst some people will prefer mvc. Webforms has been around a long time and has a very rich community and there are countless user controls you can download and buy.

Webforms feels very familar to Winforms developers and anybody that has had any experience in event based programming. Webforms in my opinion however, is quite heavyweight. It pulls the wool over your eyes to deliver you an experience coding asp.net pages that feels somewhat like creating a windows application. Drag controls onto a page (or write the markup yourself) and register event handlers for OnClick etc. and databind datasources etc.

In order to get a good grasp of Webforms you need to have a good understanding on the asp.net page lifecycle and all the events that occur. This is paramount to ensuring you databound your controls at the correct stage of the page life cycle, restore viewstate correctly etc. It's a webforms learning curve.

As others have stated MVC requires more knowledge of html, javascript/JQuery, CSS and a general understanding of the model, view, controller paradigm.

Whilst asp.net webforms 4 I believe? has made in roads at producing slightly cleaner html, you still have the issue with complex pages of bloated viewstate, ugly looking html etc.

What is nice is using a framework like ASP.NET MVC but then leveraging some webforms controls like charting, report server. Rather than placing these directly into your view as you would a page in asp.net mvc however, it's best to abstract away the webforms components from MVC and have them return an image or FileContentResult or something similar.

Joshua Hayes