Wednesday, November 25, 2009

Advantages of MVC

The main advantages of ASP.net MVC are

1) Enables the full control over the rendered HTML.
2) Provides clean separation of concerns(SoC).
3) Enables Test Driven Development (TDD).
4) Easy integration with JavaScript frameworks.
5) Following the design of stateless nature of the web.
6) RESTful urls that enables SEO.
7) No ViewState and PostBack events
The main advantage of ASP.net Web Form are
1) It provides RAD development
2) Easy development model for developers those coming from winform development.


In webforms you could also render almost whole html by hand, except few tags like viewstate, eventvalidation and similar, which can be removed with PageAdapters. Nobody force you to use GridView or some other server side control that has bad html rendering output.
I would say that biggest advantage of MVC is SPEED!
Next is forced separation of concern. But it doesn't forbid you to put whole BL and DAL logic inside Controller/Action! It's just separation of view, which can be done also in webforms (MVP pattern for example). A lot of things that people mentions for mvc can be done in webforms, but with some additional effort.
Main difference is that request comes to controller, not view, and those two layers are separated, not connected via partial class like in webforms (aspx + code behind)

Biggest single advantage for me would be the clear-cut separation between your Model, View, and Controller layers. It helps promote good design from the start.


MVC is much easier to test
MVC has better separation of responsibilities
MVC is much easier to create very complex websites with a minimum of code
Web forms are very easy to slap together
Web forms hide away complexity from the developer in web controls
Web forms use the same mental model of development that windows forms use


0 comments: