Now that Asp.Net is much more mainstream at work, the question is asked time and again as to which one should be used while developing a Web Application. One possible way to answer this question is to do a rudimentary SWOT analysis of both the frameworks.
Following is the SWOT analysis for each:
Based on the above, a broad over decision flow can be created as shown in the following picture.
Everything apart, I think there are two major considerations for choosing between the two:
- Test Driven Development – life would be MUCH easier using MVC while following TDD.
- Data Driven Application – life would be MUCH easier using WebForms if the application is data heavy.
Of course, there are no rights or wrongs, and every application can be written in both frameworks. In fact, you can even have a hybrid approach, where you can write some part in WebForms and some in MVC (theoretically).
What’s your experience?
Here’s the SWOT analysis in text form:
Asp.Net MVC SWOT
- Provides fine control over rendered HTML.
- Cleaner generated HTML.
- Superior separation between UI and code.
- Easier to unit test.
- Can support multiple view engines.
- By default uses RESTful interfaces for URLs – so better SEO.
- No ViewState (this may also be a weakness).
- Typical size of page is small.
- Easy integration with frameworks like JQuery.
- Not event driven, so maybe difficult for people who know only Asp.Net Webforms to wrap their minds around it.
- Third party control library support is not that strong.
- No ViewState(this is also a strength).
- Allows for Test Driven Development (TDD) – it is built with TDD in mind, so its much easier to write unit test cases, mock objects, and to intercept the program flow.
- Allows for reuse of the same models to present different UIs and Interfaces.
- Bigger ramp-up and training time required for developers with no or little experience in web application development.
Asp.Net WebForms SWOT
- Provides very good RAD development capabilities.
- Great designer support in Visual Studio.
- Ease of development for data-heavy LOB applications.
- Very rich control libraries and third party vendor support.
- A familiar event-driven model when compared to Windows Forms development, and so easy for developers to pick up.
- UI logic coupled with the code, and thus is hard to separate.
- Harder to unit test, so difficult to employ TDD.
- Heavy page sizes due to view state management.
- Great at creating quick prototypes for business applications. This comes in very handy when trying to show quick Proof of Concepts to clients.
- Harder to adopt to various UI views despite the various frameworks available (master pages, Themes, etc.).