Microsoft give ASP.NET developers choice to develop website or web application. This article comparing both in personal perspective, so it will not so technical article, just a personal opinion.
WebForms has been exist more than a decade and personally has been using it since ASP.NET 1.1. WebForms have strong points and weak points, it’s not perfect thing but many application I was made has been deployed run and can be maintain without much hassle.
Now this is the weak points from WebFroms according to my experience:
- WebForms html output is dirty, the html source code filled with hidden input junks in order to mimic state, as you know web is stateless, ViewState taking place to make it possible. It will helps desktop developer migrate / developing web application with ease.
- WebForms is easy and sometimes becoming complex when you have challenging requirements. It’s not rare developer pulling their hair when playing with controls. If you have money, you could buy third party controls but there’s also open source controls you could use to help you. When no third party controls fulfill your needs, you can also makes your hand dirty to make your own controls.
- Grid manipulation is ridiculously complicated especially when you’re using code behind and merging cells.
- It’s slow at first when you’re not compiling your code, everyone know this.
- Trust Level, argghhhh.
- You need Visual Studio to help you, means you need decent computer.
The strong points:
- It’s easy to make application if you don’t make it complicated. Complicated means when you’re using the N layer principle.
- It’s faster to finish the job done. ASP.NET template system, Master Pages, will help you to make different layout in no time. Controls/Components will help you on track, everything is event based and have component id.
- DataSource property and DataBinding will make your days always sunshine.
- You could create membership feature with ease, you just need to tell Visual Studio and generate the membership.
- It has been supported for decades.
- MVC can’t replace WebForms.
- You don’t need to be a ninja.
- Suitable for single programmer / small teams with limited time frame.
Now, how about MVC. MVC is not same like Classic ASP. This is different beast. I know I am talking about because I was using ASP Classic several years before migrating to ASP.NET empire.
The advantages using MVC are
- Layer separation, Model, View and Controller.
- Test Driven Development (TTD) is feasible.
- Scaffolding, template generation using Strong Typed Model.
- HTML output is as is, what you write in View is what you get. Template is doable.
- Clean URL
- Maintainable, you could use Areas to organize your application by dividing features as small units.
The weak points already known by me:
- You should create everything on your own except automation of course. So, no magical controls like WebForms controls/components.
- Strong Typed Model can makes you frustrated when you’re working with dynamic field ex. shopping cart and item details. ViewModel might be needed and then it’s become MVMC (Model View Model Controller) or more common terminology MVVM (Model View ViewModel), maybe in the future will become Service Repository Model View View Model Controller (SRMVVMC) and it will grow depends how sophisticated persons’s brain works.
- NuGet can be your tipping point to start disaster.
- You can’t pace with time especially when you’re freelance developer and doesn’t have code library.
- You need Visual Studio, yeah.
WebForms isn’t better than MVC and vice versa. Both have advantages and disadvantages. For single developer like I am, making simple application using MVC can be fast enough but when making complex application I choose WebForms. I am ignoring the trade off.