DISQUS

Emad Ibrahim: Deciding Between ASP.NET MVC and WebForms

  • Muhammad Mosa · 1 year ago
    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.
  • eibrahim · 1 year ago
    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...
  • PabloBlamirez · 1 year ago
    Decision 1:
    Need to use a flowchart to decide which approach to use?

    No:
    Great, you seem qualified to be the lead on this project

    Yes:
    Best stick to whichever methodology you know best

    Seriously 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
  • eibrahim · 1 year ago
    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)
  • PabloBlamirez · 1 year ago
    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
  • nstults · 1 year ago
    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.
  • Vladimir Kelman · 1 year ago
    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/Entr...
    http://www.strong-point.com/Blogs/tabid/87/Entr...
    http://pro-thoughts.blogspot.com/2008/09/custom...
  • Adrian Grigore · 1 year ago
    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.
  • Vaibhav · 10 months ago
    Based on this article, and others that I have read on the Internet, and personal experience, I have represented this information again: http://blog.gadodia.net/choosing-between-webfor...

    As you are a visual person, please see if that makes things clearer for the normal guy.

    Cheers.
  • eibrahim · 10 months ago
    Looks really good. You did a much better job ;)
  • Adrian Grigore · 6 months ago
    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.