Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to decide which is right, WebForms or MVC when doing ASP.NET

So I'm about to start of a small project for my sporting club for member registrations and I'm trying to decide between WebForms or MVC.

Allit will be is a user login and data capture forms (or and data retrieval), so I was initally thinking WebForms with FBA but I've wanted to have a play with MVC for a while and I was thinking that it wouldn't be too bad a choice.

But not really having a lot of knowledge of MVC I don't know if it'd be a wrong fit.

So what's a good way to decide if WebForms or MVC is the right choice?

like image 248
Aaron Powell Avatar asked Nov 30 '08 05:11

Aaron Powell


People also ask

When should I use ASP.NET MVC vs Web Forms?

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 is MVC better than Web Forms?

The MVC framework provides a clean separation of the UI , Business Logic , Model or Data. On the other hand we can say it provides Sepration of Program logic from the User Interface. More Control-The ASP.NET MVC framework provides more control over the HTML , JavaScript and CSS than the traditional Web Forms.

Should I still use ASP.NET Web Forms?

If you don't have a requirement for cross-platform support, open-source, or any of the other new features in . NET Core or . NET 6, then sticking with ASP.NET Web Forms on Windows is fine. ASP.NET Web Forms will continue to be a productive way to write web apps for many years to come.

Is MVC easier than Web Forms?

MVC is a pattern based on separation of concerns, which means that View, Model and Controller are independent of each other. As a result, working in teams, maintenance and testing of the application become simpler and easier.


2 Answers

Is this a critical, production level application or a small one-off? Can you deal with the extra time that the learning curve of MVC will take or do you need to have it done right-away? Can you afford to scrap the whole thing and start over if MVC doesn't work out? Are you willing to have the platform change (probably not much now that it's in beta) while you are developing? Is there another project that is less critical that you could use MVC on to learn it.

Depending on how you answer these questions, learning MVC on this project might be worth it. Personally, I think it is a better architecture, but a less mature technology at this point. It has certainly increased the testability of my web code. I expect to move all of my development in this direction over the next year or so, though I doubt if I will change gears in any of the projects that I have had under development for awhile. I've just started my first new project in MVC. I wasn't willing to commit to it until it went into beta and I think that it will be in production before I'm finished with the project.

like image 128
tvanfosson Avatar answered Sep 23 '22 08:09

tvanfosson


I actually really like the WebControls methodology. A lot of people are saying that "when doing MVC it's easier to Unit Test". First of all you should anyway what type of methodology you're using have a clean separation of Business Logic and your UI layer. If you do that then you can Unit Test your Business Logic regardless of which methodology you're using. Sure it might be easier and "come out of the box" with MVC, but it's not some Magic Silver bullet which is the only road that leads to Rome...

Second of all you could use WatiN which makes your app testable in ways that are far superior to conventional Unit Testing. (note I don't mean it should replace Unit Testing, but in addition to Unit Testing it takes you to a level of security previously impossible to gain)

Thirdly, the web is stateless. This is because of that HTTP is a completely stateless protocol. This is exactly what makes the web beautiful, but at the same time very difficult to develop applications for. The WebControls methodology mostly fixes this completely by having concepts such as ViewState. This takes away a lot of the hassle when doing application development. Have a look at this Ajax Calendar sample which is mostly impossible to achieve with the same (small) amount of code in any other paradigm then WebControls (disclaimer; I work with Ra-Ajax myself)

Now have a look at Stacked (Disclaimer; ...which I also work with BTW) then realize that I have so far spent less then 3 days developing what you're seeing there. Maybe someone could peak that accomplishment with MVC, but I doubt it...

I think the WebControl paradigm is very beautiful. Sure it has lacks on some points, but guess what, so does everything. The only "Silver Bullet" that exists in programming as an art form is that there doesn't exist any Silver Bullet.

When that is said, I know that Grurrah is using the Castle Project's MVC layer in addition to a WebControl based Ajax library. So to mix WebControls and MVC might be difficult, but surely not impossible...

I think MVC has gotten a lot of "deserved" hype, but unfortunately also in that process a lot of undeserved hype too...! :(

Make up your OWN mind, don't listen to the MVC evangelists trying to convince you that they have found the "Silver Bullet" to programming for the web. And wat's more, don't believe me either! I too have an agenda (get adoption to Ra-Ajax)

Make up your own mind. Asking someone if you should do MVC is like asking should I eat apples or oranges... The only GOOD answer you'll EVER get is; "It depends"...

like image 30
Thomas Hansen Avatar answered Sep 24 '22 08:09

Thomas Hansen