ASP .Net MVC 3: Microsoft did something right for a change!

In the beginning there was ASP .Net
From the very first time I tried ASP .Net I had problems with it. ASP .Net forms a clever abstraction around html and tries to fool you into believing that you are still programming windows forms. ASP .Net 1 allowed you to place controls in exactly the same way you would have done in winforms. There was a grid and you put your controls on it. The resulting HTML output was a mess. The mess seemed to pile up with ASP .Net 2.0, where aspx markup was for some reason markup built on top of html to abstract it away, creating a whole subset of new problems.

ASP .Net's control design meant that anything remotely complicated became nearly impossible. Even though a GridView was essentially an html table, getting special things to happen in the grid meant modifying strange settings in the property dialogs, googling like a mad man and occasionally just giving up. Worse still was the fact that ASP .Net controls did not play nice with custom Javascript, and that they did not use and elements by default. Every second case was a corner case and you had to break things to make them work. The gridview was not the only irritating control, but it is a good example of a bad one.

But why Microsoft?
Why did Microsoft make such a broken web framework? My guess is that they knew most developers were familiar with the forms paradigm. They pushed this paradigm onto the web to make it easy for winforms developers to make websites. The problem was that this required layers of obfuscation, general WTFing from web developers, and let people loose on web programming before they fully knew what they were doing. 

Enter MVC
When I first heard of MVC I was taken aback. It puzzled me that Microsoft would create another web framework. I went through a tutorial for MVC 2 and found myself hating it. When I later tried again with MVC 3 I was shocked.

MVC 3 Brought you back to where you belong; the html, with some embedded syntax. The direct model binding in MVC allows you to work with the field syou want to display and manipulate right inside your html. The syntax is light and it gets out of the way when you feel like doing some nice CSS layouts and you are not forced to use something as horrible and contrived as ASP .Net Ajax, which was a primary source of headaches.

MVC does bring some complications for semi veterans of ASP .Net proper. The problems come when there is no code behind, no controls, no master pages as you know them, and pretty much everything you knew is now redundant.

On the other hand you can create beautiful clean html/css designs, mix in javascript flawlessly, use the cool stuff like JQuery and be in touch with your own html. If I think back now I can remember that there were countless layers in between you and your actual web-page.

The end of Asp .Net forms
I would not recommend ASP .Net forms for new projects. You will just hamper yourself in the end and will be stuck in a world where exciting things are barely happening anymore. You will be bored, constrained and frustrated.

MVC is the way forward if you want to do .Net web development.

Post a Comment