Microsoft Dot Net Master

Microsoft Dot Net Master
Microsoft Dot Net Master

Wednesday, December 21, 2016

Why should we use MVC vs normal ASP.NET?

There are various positive points to moving towards MVC

1.  TDD support out of the box as most of the design is based on interfaces.
2.  SEO friendly URL by design (though now this is possible in ASP.NET 4 as well)
3.  No ViewState (this may seem a bit of moving backward to some), but overall a good design decision.
4.  Clean View Markup (no additional HTML emitted)
5.  100% extensible.  You can add your own controller with IOC, switch view engines at will, control model binding at wish etc.
6.   Rich UI support (possible through client side JS libraries like jQuery UI and others).  Telerik has released some controls for MVC which includes Grid control as well (which are merely HTMLHelpers)
7.  Session, JS, Ajax works.  Validation is even more powerful with DataAnnotations and jquery.
8.  Is MVC faster?  Yes by default because of lack of viewstate and clean markup.  But performance is subject and MVC by design is more performant that traditional ASP.NET webforms (though webforms can be made as fast as required.
9.  Out of the box support for mitigating antiforgery attacks and XSS vulnerability (though asp.net does has this to some extent)
10.  Out of the box minimal IOC support.
11.  Full control over rendered HTML
12.  Pluggable architecture
13.   And much more....

Couple of limitations (though not exactly)
1.  Learning curve as most asp.net developers are used to windows form model for web development.


NOTE:  Webforms is not bad.  But by design it encourages many bad practices.  A webform at the hands of careful developer is as or could be even more productive than MVC.  Just my thought.

Additional readings at http://msdn.microsoft.com/en-us/magazine/dd942833.aspx

Hope this helps.

No comments:

Post a Comment