Introduction
ASP.NET MVC is not a new architecture pattern but the debate still goes on in development circles as to which is better.So, I just want to try to clear that differences and right usage of patterns. Let we go 10-15 years back and see how web has changed..
History of the web
We've seen a number of changes in web development over the years, not always for the better:- Common Gateway Interface (CGI) - Scripting language running outside the web server. Time and resource intensive
- Microsoft Internet Database Connector (IDC) - Simple wrapper for SQL queries, with templates to format the results
- Active Server Pages (ASP) - Big step forward but mixture of HTML and code became cumbersome and confusing. Known as "spaghetti code"
- ASP.NET Web Forms - Compiled web "applications" which hides the "statelessness" of HTTP. Allowed Windows developers to more easily transfer to web developers. Heavy on bandwidth. Untestable.
- ASP.NET MVC - Reworking of Xerox Smalltalk paradigm from the 1970's. Works WITH statelessness nature of HTTP rather than hiding it. Removes ViewState
Looking Back
We've seen a number of changes in web development over the years, like: Common Gateway Interface (CGI) - Scripting language running outside the web server. Time and resource intensive Microsoft Internet Database Connector (IDC) - Simple wrapper for SQL queries, with templates to format the results Scripting Active Server Pages (ASP) - Big step forward but mixture of HTML and code became bit confusing. Known as ASP.NET Web Forms - Compiled web "applications". It seems to take this bit confusion away We are thinking MVC :)Choosing Between ASP.NET Web Forms and ASP.NET MVC?
Fact is that both are just ASP.NET server side technologies known as Active Server Pages .Now where we split them or where is difference ? Actually these are architectural patterns or the way we develop .net web based applications.Both can be the “best choice” for a specific solution depending application development requirements . When facing a decision to choose between ASP.NET Web Forms or ASP.NET MVC it is important to know that neither technology is meant to replace the other. Both are running parallely and are used as per project requirement.Now, gap between two is getting filled as Microsoft is parellely including best features of MVC into ASP.NET Webform pattern also.Some important factors we should consider while making the choice is
- If we really need to develop application rapidly, i believe ASP.NET Web Forms pattern is only and best choice
- Unit Testing - If TDD test driven development is not important, ASP.NET web form is best choice.
- If Application really doesn't bother about UI scalability(UI for multiple devices) . ASP.NET is again best choice
- Do we have
resources with good experience with Web Forms or MVC?
Because learning MVC is not simple . It has its own learning curve and needs good time to learn. - Be sure that we have people with JavaScript / JQuery based languages because MVC needs to do much with these languages
- Looking for good performance without any postback? MVC is the choice but I know it point to be debated because ASP.NET has option of AJAX