ASP.NET Web Forms Vs ASP.NET MVC
Today, ASP.NET developers have two options when building new Web projects: the old faithful ASP.NET Web Forms, or the young gun, ASP.NET MVC framework.
The difference is chalked down below:
ASP.NET Web Forms | ASP.NET MVC | |
Model | ASP.NET Web Form uses traditional event driven – Page Life cycle model | ASP.NET MVC application uses Pattern based model. No Page Life cycle like WebForms. Request cycle is simple in ASP.NET MVC model. |
State Management | ASP.NET Web Form has some state management techniques such as session state,view state,cookies etc. | ASP.NET MVC has no such state management techniques, but Model State is persisted by MVC during post backs. Also, we can use ViewBag, View Data, Temp data for state management. |
Seperation Controls | No separation of concerns. As we discussed that every page (.aspx) has its own controller (code behind i.e. aspx.cs/.vb file), so both are tightly coupled. | Very clean separation of concerns. View and Controller are neatly separate. |
Testing | Because of this coupled behavior, automated testing is really difficult. | Testability is a key feature in ASP.NET MVC. Test driven development is quite simple using this approach.Easier to Unit Test |
Statefulness | Statefulness has a lots of problem for web environment in case of excessively large viewstate. Large viewstate means increase in page size.In order to achieve stateful behavior, viewstate is used. Purpose was to give developers the same experience of a typical WinForms application. | ASP.NET MVC approach is stateless as that of the web. So there is no concept of viewstate. As controller and view are not dependent and also no viewstate concept in ASP.NET MVC, so output is very clean. |
Scripting | Along with statefulness, Microsoft tries to introduce server-side controls as in Windows applications. Purpose was to provide somehow an abstraction to the details of HTML. In ASP.NET Web Forms, minimal knowledge of HTML, JavaScript and CSS is required. | In MVC, detailed knowledge of HTML, JavaScript and CSS is required. |
Support over HTML,CSS ,JAVA SCRIPTS | The above abstraction was good but provides limited control over HTML, JavaScript and CSS which is necessary in many cases. | Full control over HTML, JavaScript and CSS.Provides fine control over rendered HTML,Superior seperation between UI and code |
Libraries | With a lots of control libraries availability and limited knowledge of other related technologies, ASP.NET WebForms is RAD(Rapid Application Development) approach. | It’s a step back. For developers decrease in productivity. |
Team Size | ASP.NET Web Form is good for small level applications but little bad for large applications.It needs limited team size. | ASP.NET MVC is good for large Enterprise level applications. It needs large team size where different teams are working together.Bigger ramp-up and training required for developers with little or no experience in Web application development |
Syntax | ASP.NET Web Form uses web forms syntax . | ASP.NET MVC uses some default customize syntax such as ASPX engine for MVC1 and MVC2 templates, and Razor engine for MVC3 , MVC4 and MVC5 templates. |
Control | ASP.NET Web Forms use Page controller pattern approach for rendering layout. In this approach, every page has its own controller, i.e., code-behind file that processes the request. | ASP.NET MVC uses Front Controller approach. That approach means a common controller for all pages processes the requests. HTML Helpers are used. |
Master Page & Layouts | ASP.NET Web Form uses Master pages for look and feel of the web page. | ASP.NET MVC uses Layouts for look and feel of the web page. |
Routing: URLs Existence | ASP.NET Web Form is a file based URLs. Means file names exist in URLs must have a physical existence in the application. | ASP.NET MVC application uses URLs Routing concepts. Means URLs are separated in Controllers , actions and others. It is based on Controller, not on Physical file. |
Open Source | ASP.NET Web Form does not follow open source concepts. | While ASP.NET MVC application follow open source concepts. |
Design and logic codes | ASP.NET Web Form are tightly coupled models. Means Design and Logic’s codes are present in one file( ASPX.CS ). | While ASP.NET MVC are loosely coupled models. Means views and logic are loosely coupled because views and logic’s are kept in separate file. |
Interactive Application | ASP.NET Web form is strong data access model.Heavy page size due to view state management; so it is not helpful to develop an interactive application. | ASP.NET MVC is a light weight application .Typical size of page is small.This is best to develop an interactive application. |
View Engines | Provides very good RAD Development capabilties | Can support multiple view engines |
Design Support | Great designer support in Visual Studio | By default uses RESTful interfaces for URL’s so better SEO |
Integration | Easy for development for heavy Database LOB applications | Easy Integration with Frameworks like JQuery |
Control libraries | Very rich control libraries and third party binder support | Not event driven, so may be difficult for people who know only ASP.net webforms to wrap their minds around it. |
UI Support | Harder to adopt to various UI views desipte the various frameworks available ( master pages, themes etc ) | Third party library support is not that strong |
UI logic coupies with the code and thus hard to spepeate | Allows for reuse of the same models to present different UIs and interfaces. | |
Great to creating quick prototypes for business applications. This comes in very handy when trying to show quick Proof of Concept to cleints
|
No comments:
Post a Comment