At this time there are a whole lot of ASP.NET web forms developers out there who confess that they simply don't comprehend ASP.NET MVC. In a lot of ways, I can connect with them. The vocal community that speaks about ASP.NET MVC talk about it with such enthusiasm that they make it appear like you'd have to be a idiot not to swap over. In certainty, the choice isn't nearly as easy.
ASP.NET web forms aren't going anyplace. These solutions have their correct place in a web developer's toolbox and it's important to discover their benefits and weaknesses. In general, the ASP.NET MVC framework tends to sacrifice ease-of-use (e.g. viewstate, validation, etc.) in order to give developers more restrictive control over the reins. This can be a excellent thing, but only if you take advantage of it. Or else it can just as readily be a problem.
With all of this, I have created a swift metric to figure out if ASP.NET MVC is best for you. The way I see it, there are about three primary purposes a developer should choose the ASP.NET MVC framework over ASP.NET web forms. If none of these causes are compelling to you, then you need to stick with ASP.NET web forms:
To Gain Control and Extensibility
As indicated out in the remarks, ASP.NET MVC delivers you much more control and extensibility options than ASP.NET web forms. You get complete management over the web page request lifecycle and the means to replace out several key items of the framework (e.g. view engine, routing, etc.), none of which is achievable with ASP.NET web forms.
In addition to this, you also acquire 100 % control over the rendered HTML. In general, the rendered HTML from ASP.NET web forms apps is dreadful. The web controls it makes use of build waste ids and invisible fields galore that not only impede the efficiency of a site, but also make CSS style and Javascript development a pain. ASP.NET MVC causes you to be more in tune with your HTML. There aren't any datagrids or repeaters that amazingly create markup for you. There aren't any invisible fields to continue to persist state for you. It's just you, the HTML, and a number of extension methods.
To Unit Test
This, in my opinion, is the most interesting reason to use ASP.NET MVC. When it comes to unit testing, ASP.NET MVC basically surpasses ASP.NET web forms. It's not even close. Whereas ASP.NET web forms requires you to jump through all sorts of hoops to test around the page event lifecycle, the ASP.NET MVC framework basically begs to be tested. There are interfaces almost everywhere proclaiming "mock me up!".
There's a reason why the biggest ASP.NET MVC practitioners also tend to be TDD promoters; it's simply because ASP.NET MVC essentially allows for for TDD. In my opinion, I believe this is where all the fervour comes from. Simply put: it's really hard to do TDD with ASP.NET web forms and genuinely painless to do it in ASP.NET MVC.
To Try out Something New
I should point out that learning ASP.NET MVC is an astonishingly engaging process since the ASP.NET MVC framework team has been so interactive in the process. I consider a great part of the charm 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 started so many posts and dialogues over best practices that just following along presents you to ideas you might formerly have been uninformed of. I would really propose mastering the ASP.NET MVC framework for this reason alone.
So there it is. Apart from those three, I can't think of any other reasons why a developer would study ASP.NET MVC. Possibly this is why the adoption rate isn't nearly as high as we believe it should be. The motivator for using the framework primarily boils down to unit testing, control/extensibility, and feeling of boredom/curiosity. Fine reasons, but seldom game breakers for the large greater part of developers out there.
Loading...