subject:
Is Mvc Really A Worthwhile Move Forward
[print this page] There are a bunch of ASP.NET web forms programmers out there who admit that they simply don't fully grasp ASP.NET MVC. In a lot of ways, I can associate with them. The expressive minority that speaks about ASP.NET MVC speak about it with such fervour that they make it appear like you'd have to be a idiot not to change over. In actuality, the verdict isn't nearly as straight forward.
ASP.NET web forms aren't going anywhere. These solutions have their right place in a web developer's toolbox and it's crucial to recognize their benefits and weaknesses. In general, the ASP.NET MVC framework tends to forfeit ease-of-use (e.g. viewstate, validation, etc.) in order to present developers more restrictive control over the reins. This can be a great thing, but only if you take advantage of it. Otherwise it can just as readily be a problem.
With all of this, I have formulated a easy metric to identify if ASP.NET MVC is suitable for you. The way I see it, there are three or more primary factors a developer should decide on the ASP.NET MVC framework over ASP.NET web forms. If none of these reasons are persuasive to you, then you need to stick with ASP.NET web forms:
To Increase Control and Extensibility
As directed out in the remarks, ASP.NET MVC supplies you more management and extensibility options than ASP.NET web forms. You get total management over the site request lifecycle and the potential to swap out several key sections of the framework (e.g. view engine, routing, etc.), none of which is doable with ASP.NET web forms.
In addition to this, you also acquire total management over the delivered HTML. In general, the rendered HTML from ASP.NET web forms applications is dreadful. The web controls it utilizes produce garbage ids and disguised . fields in abundance that not only hinder the efficiency of a site, but also make CSS style and Javascript development a pain. ASP.NET MVC makes you to be more in tune with your HTML. There aren't any datagrids or repeaters that amazingly produce markup for you. There aren't any hidden fields to persist state for you. It's just you, the HTML, and a few extension procedures.
To Unit Test
This, in my viewpoint, is the most convincing rationale to use ASP.NET MVC. When it comes to unit testing, ASP.NET MVC easily surpasses ASP.NET web forms. It's not even close. Whereas ASP.NET web forms needs you to jump through all kinds of hoops to test around the web page event lifecycle, the ASP.NET MVC framework practically begs to be tested. There are interfaces almost everywhere proclaiming "mock me up!".
There's a good reason why the greatest ASP.NET MVC fans also are likely to be TDD proponents; it's because ASP.NET MVC in fact makes it possible for for TDD. Personally, I think this is where all the passion comes from. Simply put: it's definitely hard to do TDD with ASP.NET web forms and really very easy to do it in ASP.NET MVC.
To Try out Something Different
I should point out that learning ASP.NET MVC is an extremely engaging process since the ASP.NET MVC framework staff has been so interactive in the process. I think a huge part of the attraction of ASP.NET MVC is that the community's knowledge is not only being taken into consideration, it is positively being sought after. The framework has sparked so many talks and dialogues over best practices that just following along presents you to ideas you might formerly have been unaware of. I would really advise understanding the ASP.NET MVC framework for this purpose alone.
So there it is. Apart from these three, I can't think of any other reasons why a programmer would study ASP.NET MVC. Possibly this is why the adoption rate isn't nearly as high as we consider it should be. The incentive for using the framework fundamentally comes down to unit testing, control/extensibility, and feeling of boredom/interest. Fine reasons, but not really game breakers for the huge majority of web developers out there.