Ever since I started programming with ASP.NET, I've been using Web Forms. The Web Forms framework wraps the whole web page in a single form and handles everything via post backs and events from there. Wiring the navigation between pages can become a mess quite quickly. It also provides a code-behind file which handles the displaying logic for the page... in theory. In practice, the code-behind files are just a gateway for putting business logic in them, they are evil.

Web Forms also require the programmer to learn about the page life cycle and to deal with the ViewState which can lead to monstrous pages (until you truly understand ViewState). It also generates unmanageable dynamic identifiers which makes working with controls with JavaScript a more difficult problem than it should. The good news is that after working with all of this for more than 2 years, I've become quite proficient with them and learned to use them correctly (mostly). Also, you don't really know a language (or framework) until you hate something about it.

The new technology

I've been looking at the ASP.NET MVC framework and I'm really interested to try it out. We're about to start a big project so since we're probably going the MVC route in the future, now could be a good time to start working with MVC. Although, there are a few things to consider before switching to a new technology:

  • Why do we need to use a different technology?
  • Will we be able to do what we were doing before with the new technology?

I partially answered the first question in the first part of this post, Web Forms has drawbacks. However, MVC has drawbacks too, we just don't know them yet. Learning a new technology is fun, but the client doesn't care how much fun we have while doing their project, they only care about the result. The good news is that MVC performs really well, especially because it makes it harder to do bad things (although code-behind files are back in the latest development builds).

Now, we only need to be able to do what we used to be doing, that is making web pages. The first thing we wanted to replicate was building templated user controls (like a repeater or grid view). Fortunately, someone (Telerik) has been there already and managed to solve that little issue for us. You can even download the source code for the Telerik extensions for ASP.NET MVC.

ASP.NET looks promising, we only have to watch ours backs and not start programming in MVC instead of into MVC.

Programmers who program "in" a language limit their thoughts to constructs that the language directly supports. If the language tools are primitive, the programmer's thoughts will also be primitive.

Programmers who program "into" a language first decide what thoughts they want to express, and then they determine how to express those thoughts using the tools provided by their specific language.

Source: Code Complete

Further reading

http://west-wind.com/weblog/posts/198731.aspx