Deciding Between ASP.NET MVC and WebForms

I am trying to create a decision flowchart for my ASP.NET MVC book and wanted to get some community feedback.  Does this diagram make sense?  What other factors should one consider that should make it into the chart?

image

Things to Note

I have tried to use the general consensus of the community for each decision.  For example, some might argue that MVC is better for prototyping but I would say the majority would disagree.

Keep in mind that these choices are not set in stone and are not mutually exclusive but are more like a guide to which platform would be better suited to satisfy a particular requirement.  For example you might want to use TDD but still end up choosing on WebForms.  (I should probably assign a weight to each question)

The "No" branch doesn’t mean exactly NO.  I mean, answering No to "Want cleaner HTML?" doesn’t mean you have something against clean HTML or you want crappy HTML – no one wants that.  Think of the question in terms of "is clean html important to you?" 

Let me hear your feedback below and I will incorporate it in version of 2 of the diagram and post it back on the blog.  Hopefully, this will help someone choose between ASP.NET MVC and WebForms on a new project.

Also, I don’t think a flowchart diagram is the best type of diagram for this type of decision tree.  Can you suggest a better format?

Advertisements

0 thoughts on “Deciding Between ASP.NET MVC and WebForms

  1. Well, very interesting flow chart. However I am not very experianced in MVC. But I would like to give an opinion actually. For heavly Data Driven, that might include too much GridViews like controls etc.. This is also can be achived in MVC. Might need some more work maybe, but still achivable. And soon we might find some helpers to resolve such things.So the port previous to this one RAD! is much coverring for faster development that will include such data driven scenarios.That was just my idea. I see the 3rd node is a bit confusing.

    Like

    • You are absolutely right. Ofcourse, you can do grids and form validation in mvc but the idea here is which framework is easier to use for that specific task. You can pretty much create a sortable, pageable and editable grid in webforms by simply dragging a table from your database into your webform…

      Like

  2. Decision 1:Need to use a flowchart to decide which approach to use?No:Great, you seem qualified to be the lead on this projectYes: Best stick to whichever methodology you know bestSeriously though, maybe these would just be better as a small list of pros and cons for each approach, leaving it to the readers good sense to decide what to do with that information

    Like

    • Good point. But I am a visual person and love to see charts :)… But I do also have a list of “strengths” of both frameworks… Do you have other suggestions or anything else that you think should be in the list below?MVC Strengths 1. Absolute control over rendered HTML 2. No ViewState 3. No PostBack 4. Clean separation of responsibility (Model, View, Controller) 5. Better suited for TDD 6. Steeper learning curve (might depend on your background)Web Forms Strengths 1. Better suited for Rapid Application Development (RAD) 2. A plethora of third party controls and tools 3. Better integration with the IDE (Visual Studio 2008) 4. Abstraction of low level layers (HTML, CSS, JavaScript)

      Like

      • Regarding Web Form Strength 1 (Better for RAD) that is on balance probably fair but to get the most from the RAD experience you have to be prepared to just accept the web forms way of working databinding, standard controls etc. If you do decide you want to deviate from the well trodden path then I find that the amount of code that is required to perform simple tasks (if done in MVC) can seem disproportionate.For example to add a hidden field per row in a repeater and bind a value to it requires the on_row_databinding (close?) to be used and the control found in the control tree before a value can be assigned to it. Some things just feel more complex than they need to be if you understand the what is really happening behind the webforms facade

        Like

  3. I agree that a flow-chart may not be the best decision making tool in this case. I do like the idea of weighting the pros and cons, but a flowchart strongly suggests a single path, in which decisions at one node will determine your next steps, and this implies a sequential relationship among the decision points. In a situation such as this, that just isn't the case, and so a flowchart has the potentially to be extremely misleading. A weighted set of priorities that products a score for each choice would be somewhat better. Personally, I think the decision comes down to the skill level and experience of the dev team, and how critical use of third party UI libraries is. If you *need* a third party UI suite like Telerik's, Infragistics or DevExpress, you can't choose MVC. If you have very junior developers that will rely heavily on copious documentation, books, training from MS, you probably can't choose MVC. Otherwise, MVC is a very good choice and will pull your team into a new (very health) paradigm of software development because most of the community activity around MVC is practicing TDD, DDD, using ORM's, etc.

    Like

  4. To me, one of the worst features of WebForm is posting to itself. It creates constant problems with a correct behavior of a browser's “Back” button. The cleanest aproach is to use PRG pattern, and WebForm does not give any feasible way to do that. My great hope is that ASP.NET MVC will resolve this issue.http://www.strong-point.com/Blogs/tabid/87/Entrhttp://www.strong-point.com/Blogs/tabid/87/Entrhttp://pro-thoughts.blogspot.com/2008/09/custom

    Like

  5. After following your flow chart, it seems like I should consider both. I'd be surprised if the outcome would be different for an developer… ;-)Anyway, for cleaner generated HTML there are workarounds to (partially) achieve this with Web forms as well, such as the ASP.NET 2.0 CSS Friendly Control adapters ( http://www.asp.net/CssAdapters/ ). I just installed them a few days ago and they seem to work great.

    Like

  6. ASP.NET MVC is actually pretty good at validation, IMO much better than web forms (at least it is now, not sure if it was the same over half a year ago when you wrote the article). The reason for this is that you can centralize all validation rules on the model, so if multiple forms are using the same rules you'll still only have to write them once. There are even client-side validation frameworks for ASP.NET MVC (xVal for instance). So lots of form validation would actually be a reason to use MVC.

    Like

  7. ASP.NET MVC is actually pretty good at validation, IMO much better than web forms (at least it is now, not sure if it was the same over half a year ago when you wrote the article). The reason for this is that you can centralize all validation rules on the model, so if multiple forms are using the same rules you'll still only have to write them once. There are even client-side validation frameworks for ASP.NET MVC (xVal for instance). So lots of form validation would actually be a reason to use MVC.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s