Last week my friend has started a new web based project in .NET, he asked me In which technology he should go ASP.NET or ASP.NET MVC ?
Now a days everyone talk about ASP.NET and ASP.NET MVC but if we asked them, when to favor which technology ? all goes confused. There is no clear-cut answer, and rightly so. This article will help you to choose between ASP.NET and MVC depend upon your requirement and tell you Advantages / Disadvantages of ASP.NET MVC. Lets start with it.
Basically ASP.NET was developed to improve the speed and performance of classic ASP, Microsoft's ASP.NET, one of the most successful web application development frameworks ever.You can use ASP.NET to fast develop and deploy highly scalable, high-performance web applications in a managed environment
When to use ASP.NET
1. RAD – Rapid Application Development
RAD is the strong point of ASP.NET, ASP.NET does not deal with HTML markup directly, rather it gives set of powerful tools to developer to design and develop web application, compiler then convert it to Markup and show it on web application, so developer does have to take care of internal architecture and can develop application rapidly.
When Cost is matter ASP.NET is really helpful to you. As it is bit old technology and start of the web development phase, maximum developer community is aware of it and develop using ASP.NET, where as MVC is newer than comparing with ASP.NET, so there is cost incurred to development with ASP.NET MVC
3. Stable implementation
ASP.NET Web Forms implementation is now a stable and robust with many years of deployment experience. over the year ASP.NET is upgraded and is now more firm and dependable.
Drawbacks/Limitation of ASP.NET
- Customization is not possible and easy with built in ASP.NET control set.
- As ASP.NET create its own markup tags while rendering on browsers which is very much different than actual HTML tags so flexibility among cross browser compatibility and devices are less
- The generation of each control ID is vary framework to framework, which needs to make changes in scripting as well.
- maintaining data between post back is additional task for ASP.NET, as it's page life cycle is depend upon ViewState
- Final web page render size is also an issue for ASP.NET as view state increase each page size.
- ASPX pages has fixed URL render pattern which will slow down SEO and search engine crawling.
- ASPX page does not render without its code behind, so there is additional load on web page each time
I have read somewhere, "MVC framework is not efficient unless you're willing to roll up your sleeves and build your own project specific infrastructure ", I think it is really true, MVC is complex for Oldies and Simple for New projects, ASP.NET MVC is support Test-driven development (TDD) . I have discuss some points about ASP.NET MVC below. which includes When to favor, Advantages and limitations.
When to use ASP.NET MVC
ASP.NET MVC has very scatter structure so code separation is strong point, No doubt ASP.NET MVC has many great features like Bundling, minification, Parallel Development, Test-driven development ( It actually leads to very short development life cycle), Web API (for building HTTP service), URL Routing Scaffolding.
But there are some facts and things that we need to consider before using ASP.NET MVC, so lets consider some priorities while going with ASP.NET MVC
1. Complex form structure
ASP.NET MVC has more hold on HTML so When you want to develop a complex form structure, you can use it, MVC allows for any number of forms on the page
2. Purpose of website is for public
If you are build website or web application targeting to public like banking or reservation then you need to go for MVC as it has very SEO friendly and lightweight.
3. separation of concerns
When your concern is code separation you can go for MVC as it has very scattered structure with Model, View and controller, here is very less chances of getting things more complex.
4. Different view device wise
If you are targeting you development towards multiple render devices then go for MVC it offer design flexibility so that same web page can be easily render on desktop browser, mobile and smart phone devices in simple render mode
5. Easy Unit testing
As with the help of MVC we can developed loosely coupled application, it is very easy to test each module independently,
Dependency Injection is more useful in such cases
7. Easily blend with other technology
8. Automatic Unit Testing
If you want to go for automatic unit testing then ASP.NET MVC is good for you.
Drawbacks and limitation of ASP.NET MVC
- It is not easy to understand and code, within limited time frame
- ASP.NET structure is very much different from MVC it is Difficult to convert an existing site from ASP.NET to ASP.NET MVC.
Truth of life
- More often practical conditions are not same as hypothec conditions the choice between ASP.NET and ASP.NET MVC is not a single cup of tea, it is vary from project to project and team to team
- If you have very large ASP.NET project then do not go for MVC as it is like to build your project from scratch, it may be leads to time and cost wasting
- If you want to deploy project targeting more user volume and devices then go with MVC
- Friendly URL's for SEO with no viewstate and cleaner HTML is the powerful point which leads MVC to perform faster
Finally, There are Pros and Cons for both ASP.NET and ASP.NET MVC, This article is small attempt to put focus on features point. It helps you to take decision easy between these two. But the final Answer is remain same "it depends".
Suggestion and Queries are always welcome