Someone asked me the other day, between Standard ASP.Net and ASP.Net MVC, which do I prefer and why. Although I have long been an ASP.Net developer, I have to say that I easily would choose MVC over standard ASP.net any day (and twice on Sunday). I feel this for the following reasons:
- Separation of interests: The three sections of MVC are logically separated: Model(Data), View(.aspx page), Controller (Code that feeds data to view).
- NO VIEWSTATE: If you are new to MVC, you think this is a bad thing, but it is actually very, very good.
- Performance: Because there is no viewstate, there is no decoding/encoding of viewstate, no unneeded data passed back and forth to the browser.
- MVC is more AJAX/JavaScript friendly. For example: No more funky control names like ‘ctl00_pagebody_ucSetupList_gvSetups_ctl02_hlSetupName’.
- Easier to test. Separation of interests allows you to test the controller methods directly.
- No events. Like ViewState, if you are new to MVC, you think this is bad. Actually this too is very very good.
- Did I say NO VIEWSTATE? Yes, but it bears repeating.
Personally I am in love with MVC and no longer enjoy working on any of my legacy ‘standard’ ASP.Net sites.