Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's your choice for your next ASP.NET project: Web Forms or MVC? [closed]

People also ask

Should I use Web Forms or MVC?

Asp.Net Web Form has built-in data controls and best for rapid development with powerful data access. Asp.Net MVC is lightweight, provide full control over markup and support many features that allow fast & agile development. Hence it is best for developing an interactive web application with the latest web standards.

Why MVC is better than ASP.NET Web Forms?

MVC provides better support to TDD (Test driven development). TDD is related to the test first programming concepts of extreme programming. It helps us to reduced time in reworks and helps create loosely coupled code. MVC enforces separation that reduces complexity of project structure.

Should I still use ASP.NET Web Forms?

Despite what you might read online, ASP.NET Web Forms aren't dying out and they certainly aren't going away anytime soon. It's one of Microsoft's oldest . NET technologies, which means that it's also the most updated and mature as well.

What is next after ASP.NET MVC?

ASP.NET is already antiquated, if you're looking to get into that world I would recommend Blazor which compiles to webassembly and can be used on the client side or the server side.


MVC baby! And JQuery!

Edit: OK, it's fair enough to say my response warrants a little more info.

I'd choose MVC for the following reasons:

  1. I have worked in Rails and found it highly productive. ASP MVC has borrowed so much from Rails that it feels like a direct port in some ways (and that's a good thing in my mind).
  2. AJAX is important, but I hate the Microsoft "Atlas" approach to AJAX (whatever the product name is these days). If you're going to do AJAX, you need to understand the HTML and the JavaScript. Frameworks that hide that from you are hurting you more than they are helping you (IMO).
  3. JQuery has taken over the world it seems in terms of JavaScript frameworks. ASPMVC is well-integrated with it. I want to learn it, so there's great alignment here.
  4. The whole "control" model is a neat idea, but it is more complicated than it appears on the surface. For example, look around on SO for questions about how a UserControl can find its highest level containing control and so forth. The control hierarchy abstraction has leaks in it. Grids are great if they do what you want out of the box, but it's very very hard to customize them to do something they weren't made to do. And the best grid controls on the market (the ones that are highly customizable) are large, bloated, overly complicated beasts. Maybe that shows us that we should drop back down to HTML and let loops in our views do that kind of thing for us.
  5. I believe I can build complete, beautiful apps in ASPMVC much faster than in ASP.Net (and I've got some years of ASP.Net under my belt). Look at StackOverflow ... built quickly on ASPMVC with JQuery, and it's fast, scalable and a joy to use IMO.
  6. Oh, and it's completely open source! It is ok to read the source code, blog about it, and even modify then redistribute it!

I would choose MVC simply because it's designed to be testable and mock'able. That would be the major factor in my decision.

WebForms are much more difficult to Unit Test because they're rooted in several concrete classes that are difficult, it at all possible, to Mock. These include HttpContext, HttpResponse, HttpRequest and HttpCookie.

MVC is designed to be testable and it's API greatly facilitates doing so.

Good article on the testability of MVC: http://dotnetslackers.com/articles/aspnet/ASPNETMVCFrameworkPart2.aspx


Personally, I have decided to use both...

If it's a website (viewed online), I have decided to use ASP.NET MVC. If it was an application (web application with a single purpose) I have decided to use web forms.

This decision is purely based on the case use and the solution you trying to deliver. If you are interested in good SEO and a faster website, MVC is much cleaner HTML and faster than web forms.

However if you after a complex functionality with a lot of filters, grids, postbacks on the same page and you are well experienced in Web Forms, just stick with it.


If I were starting today I would probably still stick with webforms because of the volume of knowledge and resources surrounding it.

That said I really want to give MVC a shot and as others have mentioned the excitement within the community means it wont take long before there is a lot of support for it.