views:

235

answers:

4

This is a difficult question to ask because it's so wide ranging.

Does anybody know of a scoring system of questions that would aid in choosing between a WebForms and MVC application at the start of a project?

e.g. Is TDD an important part of this project? (If yes score 1 for MVC and 0 for WebForms)

+2  A: 

I have a single question test (disclaimer: it's far from perfect, but does the job a lot of time in making you lean toward each of the technologies):

Is your application more form oriented (e.g. intranet stuff or something) or you are building an Internet-facing Web site (e.g. StackOverflow). In the first case, I'd probably go with Web forms. The latter case is probably better satisfied by ASP.NET MVC.

Another thing: these two are not the only paradigms out there. Before MVC days, I've done several projects by building HTTP Handlers that do the routing and other stuff that MVC does. You could also strip the Web form part of ASP.NET and just use non-server-form Web controls (while you'd do it in a standard Web forms project, I can hardly call this style ASP.NET Web forms).

Mehrdad Afshari
+1  A: 

Usually, the decision to use WebForms or MVC boils down to controls. If you are going to be using a lot of server-side controls, then WebForms is for you. If you don't have that burden then MVC, at least in my opinion, is much cleaner, and more testable.

After using both of them the way I decide now is: Do I need to use server controls? If I don't then I default to MVC.

If you were stuck with WebForms for some reason then you could implement the MVP (Model-View-Presenter) pattern to separate the view from the logic and have some hope of unit-testing the codebehind.

Rezlaj
+2  A: 

I would consider the following:

  1. Current Skill Set of the team. If you have a large team that aren't going to pick up MVC quickly but are comfortable with Web Forms I'd stick with Web Forms

  2. What level of control do you need? MVC gives you more control but that also means you'll be doing a lot of extra things your self. WebForms gives you a lot less control but there are a lot more things in the box. If being able to control the HTML output is important to you than maybe MVC is a better fit.

  3. Will you need third party integration? There isn't a whole lot of 3rd party control support for MVC however there is a ton of support for webforms. Getting a nice grid in webforms is simple, however you'll be writing a lot of your own code in MVC to solve that problem

  4. As you mentioned, is TDD desirable?

  5. State management is a lot easier in web forms

lomaxx
+2  A: 

Unless you are working on a very data centric app and need server controls with databinding and viewstate, I would go with MVC.

I haven't made anything serious in web form since MVC preview 2. MVC is much better with regard to design patterns and best practices.

And yes IMO TDD is very important and gives more than 1 point to MVC.

Sruly