views:

1944

answers:

8

Firstly, I'm a software engineer doing web development in ASP.NET. We have a custom framework that we use that sits on top of .NET so most of my development work leverages more of our internal framework and less of the traditional web forms model.

I've done web development for a couple years on my own as well, but I mostly use LAMP (with some work with Ruby on Rails) for these projects; however, I've recently had some opportunities for .NET development. The problem is that most of my ASP.NET experience, as you can see, comes from an internal framework and less from the native controls.

I have no problem getting a book (or three), a few podcasts, and some web sites, and getting down deep in the ASP.NET WebForms; however, with ASP.NET MVC on the horizon and with my experience (and appreciation) for an MVC framework, I feel as if I'm at a crossroad - should I pursue an in-depth understanding of web forms, or do the same for MVC?

I'd like to note that I've read the posts dealing with WebForms vs. MVC, so I'd like to clarify that my question is that I have some concerns for choosing either technology over the other. These are:

  • How hard would it be going from one to the other, should I need to do so, down the road?
  • I like to typically write my presentation code (XHTML/CSS/JavaScript) by hand with a JavaScript framework and tend to stay away from the code-front controls.
  • Am I shooting myself in the foot (in terms of marketability in the future) if I choose one over the other?

Clarification

My pursuit of MVC would not be done so at my job so no re-writing of our code would occur. This question is related solely to projects unrelated to my 9-to-5.

+21  A: 

There's a lot of great information on Scott Guthries blog about MVC and WebForms (he's the guy "in charge" of the asp.net platform/IIS7 and a whole host of other stuff).

One of the things I've seen said on his blog more than once is that MVC and WebForms can and do compliment each other. As with everything else, use the tool best suited for the job. For a 5 page corporate information site then WebForms is probably the better of the two, for a corporate employee information system on the intranet, MVC may well be better.

Rob
+4  A: 

To answer your questions - it would probably require a near rewrite of all the ASP.NET code if you switched from one to the other. There might be some reuse in there, but probably not a lot. Routing has been extracted out so you could use that in both areas.

If you like writing the presentation code by hand, then you'll like MVC more. WebForms practically relies on the <asp:foo> controls. MVC does have some basic templating built in, similar to other MVC frameworks.

In a Microsoft world, WebForms is dominant since its been around the longest. However, outside of MS, the MVC format has been gaining tons of traction, so I'd bet that ASP.NET MVC will be good in the long run.

swilliams
+1  A: 

See

Should I migrate to ASP.NET MVC?

Despite the title, this question refers to "a project about to start".

Of course, with MVC still somewhat in flux, this post may be a bit dated.

harpo
+9  A: 

In the past, I've worked with ASP.NET, WinForms, PHP, and plain old HTML and JavaScript applications. In my opinion, the WinForms paradigm is great for desktop applications (I haven't used WPF, although), but applying that same type of framework to the web with ASP.NET never quite sat well with me. It would get in the way of my understanding of the underlying HTML, CSS and JavaScript. The MVC framework is much better at getting out of your way. So, if you like to do that sort of thing, I suggest that you use the MVC framework as your default choice.

Also, more and more applications are going down the road of having multiple user interfaces. The MVC framework makes it a little bit easier to go down this path, whereas ASP.NET encourages you to put everything in your code behind. Therefore, in terms of marketability, the more that you are able to plug in different interfaces into the same underlying business application, the better off you will be.

ottobar
+9  A: 

I would highly recommend ASP.NET MVC for any greenfield applications, especially any you wish to use TDD with. I recently migrated an ASP.NET application to MVC and it was a very very unpleasent experience. The main problem with the migration was that:

  1. Wasn't my code
  2. Business Logic was tightly bound to HttpContext
  3. Loads of the UI html was being generated in the code behinds

If you want to start with a WebForms application and move it to MVC at a later date, remember to try and keep everything cohesive and loosly coupled.

Chris Canal
+1  A: 

I think you should try writing out a simple WebForms application at various levels of using ASP.Net. You could for example write all the UI in HTML and JavaScript and use the code behind to process the form so that you minimally use ASP.Net in the first run.

Second time, try using the built-in ASP.Net controls for things like text boxes and buttons and see how much easier it looks. You may want to use the MVC pattern for the code which I think would be useful for someone not used to ASP.Net's web controls. Also the built in AJAX functionality may be worth trying out at this level.

Thirdly, try using the ASP.Net MVC which is still at a preview stage and may have bugs and kinks to work out that you may find annoying and troubling to stay with such a technology but usually the kinks get worked out eventually or at least most of the really big ones. ;)

JB King
+6  A: 

Am I shooting myself in the foot (in terms of marketability in the future) if I choose one over the other?

At my company which I think is not very different from most others it would be no good choice to know ASP.NET MVC but no ASP.NET. If you were hired as the web-guy they would require ASP.NET. This will not change for some time.

If you can still spare some time then digg into MVC. Its fun to learn it and use it.

At my job I do 50% ASP.NET and 50% ASP.NET MVC. I never think: OMG the other framework is so much better.

Malcolm Frexner
+1  A: 

I've found very useful blog post which will help to choose - http://blog.stevehorn.cc/2009/05/aspnet-webforms-and-mvc.html And I completely agree with that chart.

zihotki