views:

2501

answers:

9

As someone with some winforms and client applications experience - is it worth going back and learning the way traditional ASP .NET pages work, or is it okay with moving straight into ASP .NET MVC?

I'm kind of looking for pitfalls or traps in my knowledge of general C#, that I won't know from the screencast series and things on the ASP .NET site.

+18  A: 

Here is the great thing about MVC. It works closer to the base of the framework than normal ASP.NET Web Forms. So by using MVC and understanding it, you will have a better understanding of how WebForms work. The problem with WebForms is there is a lot of magic and about 6 years of trying to make the Web work like Windows Forms, so you have the control tree hierarchy and everything translated to the Web. With MVC you get the core with out the WinForm influence.

So start with MVC, and you will easily be able to move in to WebForms if needed.

Nick Berardi
+2  A: 

ASP.Net Webforms is a completely different abstraction over the base framework than ASP.NET MVC. With MVC you've got more control over what happens under the covers than with ASP.NET Webforms.

In my opinion learning different ways to do things will usually make you a better programmer but in this case there might be better things to learn.

Mendelt
A: 

IMO, there are more pitfalls in normal web forms scenarios than with just MVC. Viewstate and databinding can be tricky at times.

But for MVC, it's just plain simple form post/render things old-school way. Not that it is bad, it is just different, and cleaner too.

chakrit
+1  A: 

I can't really speak technically about MVC vs "traditional" as I have only used the traditional model so far. From what I have read though, I don't think one is vastly superior to the other. I think once you "get it", you can be very productive in both.

Practically though, I would take into consideration that most books, code samples and existing applications out there are written for the "traditional" way. You have more help available and your skills will be more useful for employers with existing applications written in the "traditional" way.

I don't agree on the code samples argument. MVC is HTML/Javascript working against C# methods. The webcontrol stuff is taken out of there and not really *replaced* with something else. As every web technology works with HTML and can (should) work with javascript, I've found solutions to my problems much faster than figuring out how to do something with an asp.net control.
Thomas Stock
There are only a few new things one has to learn to get started with ASP.NET MVC if you have classic ASP.NET experience, and a great deal of things you can forget about.
Thomas Stock
+5  A: 

I agree with Nick: MVC is much closer to the real web paradigm and by using it you'll be confronted with how your website really works. WebForms astracts most of these things away from you and, coming from a PHP background, I found it really anti-intuitive.

I suggest you directly jump to MVC and skip WebForms. As said, you'll be able to get back to it if needed.

Lck
A: 

I'm still waiting for that day that Viewstate becomes 'tricky'...

Shawn Simon
+1  A: 

It depends on your motivations. If you're going to sell yourself as an ASP.NET developer, you will need both.

If this is just for your own pleasure, then go to MVC.

My personal feeling is that webforms will be around for quite a few years more. So many people have time and energy invested in them. However, I think people will slowly (or maybe not so slowly!) migrate. Webforms was always just a way to get drag-and-drop VB4 morts to think about web development. It kindof worked but it does take away alot of control.

IainMH
A: 

If you don't know how or havent has experience with raw level web request / response and raw html/css rendering then MVC will would be good place to start. You will then better understand the pros and cons of both webforms and mvc. They will both be around in the future as the both address different needs.

Though I will say webforms is a highly missused and abused platform. So much of the "look no code" rubbish gives all who use it a bad name. Put in the time to understand it and use it properly you'll find its a very extensible and robust platform.

+2  A: 

ASP.NET MVC is for developers who desire to decouple the client code from the server code. I have wanted to write JavaScript, XHTML, CSS clients that can move from server to server (without regard to server technology). Clients are time-consuming to fit and finish so you would want to use them (and sub-components) for as many servers as possible. Also this decoupling allows your server to support any client technology that supports HTTP and angle-brackets (and/or JSON) like WPF/Silverlight. Without ASP.NET MVC you were forced into a hostile relationship with the entire ASP.NET team---but Scott Guthrie is a cool dude and brings MVC to the table after years of his predecessors (and perhaps Scott himself) almost totally focused on getting Windows Forms programmers to write web applications.

Before ASP.NET MVC, I built ASP.NET applications largely based on ASHX files---HTTP handlers. I can assure you that no "real" Microsoft shop would encourage this behavior. It is easier from a (wise) management perspective to dictate that all your developers use the vendor-recommended way of using the vendor's tools. So IT shops that are one or two years behind will require you to know the pre-MVC way of doing things. This also comes in handy when you have a "legacy" system to maintain.

But, for the green field, it's MVC all the way!

rasx