Microsoft MVC vrs WebForms – What do you prefer

I recently had a lively discussion with a colleague over what is better Microsoft MVC or WebForms.  My friend had stated he liked MVC because it kept his code organized and clean.  He also stated that he has seen many WebForm projects that was just a mess of spaghetti like code.  My response was simple; It is all about developer discipline.  If the coder is well disciplined and refactored their work rather than just keep stacking on band aides and fixes, the code would be clean and organized.  I think it was said well “It is the latest craze!”.

I find that MVC projects are often 3 times the number of files and code.  The MVC projects can be a maintenance nightmare just because of the bloated file structure.   I have actually witnessed a developer getting lost in their own code when developed in MVC ( no it was not me ).

I think it would be interesting to go head to head on a developer challenge.  I would write the same project in WebForms using libraries, classes and user controls while my friend wrote his in MVC.  At then end evaluate who developed the code faster, cleaner and more maintainable.

I am not totally against the idea of MVC projects. They have their place with frameworks such as Ruby on Rails and PHP.  I also believe MVC is a good choice for smaller and tightly focused projects.  I have done MVC projects and see why some may choose the route.

I find building larger projects with custom user controls, my own business layer libraries and my custom database routines is faster, cleaner and more efficient all around.  Microsoft has given developers all the options required ( masterPages, Custom Controls, User Controls, Class Libraries, WebForms ) to get the job done cleanly, effectively and more organized without the use of the MVC framework.

What do you prefer and why? I am interested in learning from you.

Andrew Pallant (@LdnDeveloper) has been a web, database and desktop developer for over 16 years. Andrew has worked on projects that ranged from factory automation to writing business applications. Most recently he has been heavily involved in various forms for ecommerce projects. Over the years Andrew has worn many hats: Project Manager, IT Manager, Lead Developer, Supervisor of Developers and many more - See more at: http://www.unlatched.com/#sthash.8DiTkpKy.dpuf

Posted in Design, Developement, Developer, Ideas, Personal Thoughts, Web Tagged with: , ,
3 comments on “Microsoft MVC vrs WebForms – What do you prefer
  1. Bob Delaney says:

    These days, a large proportion of the views of a web page are coming from a hand-held or tablet device. If web forms render properly on handheld devices, I have yet to learn how to do that elegantly. Of course, as a weekend code jockey, there are a lot of tasks I have not got the time to learn to do proficiently, and then repeat often enough to fully internalize. However, my old paradigm of web forms done with trusty old VB seems to have been overtaken by MVC with C# on the server. My JavaScript and CSS were always good enough to get the job done, but I can’t see any way around having to move from VB to C# to grasp other people’s code, and to use MVC in order that my sites render on tablets and handheld devices. Glad you raised the subject. Looking forward to the comments of others.

    • I had never had an issue with webForms looking good in a tablet or even a mobile phone. My main website is actually all webforms ( http://unlatched.com ). Not everything on my website is perfect, but that is because I have not had time to make it perfect. I do a lot of web development that has to look good on all mobile devices.

      I find the battle of tablets and mobile phones can be won using the 960 grid layout.

      I come from a VB background, but migrated my website to C# using webForms a few years ago. I started to redo my site in MVC, but found the number of files was getting ridiculous.

      There is a lot of discussion from this very topic happening in in the Canadian Developer Connection on Linked In : http://linkd.in/1cPBbej

  2. Tim Gapinski says:

    with the new advancements in bootstrap options such as zurbs foundation, webforms and visual studio express especially can more than stumble with integrating these amazing ruby-ish front ends that are geared with a refreshing user and mobile first approach. Since it’s now 2014 I feel well behind the migration to mvc, but it’s really not much of a choice. I Am a one man shop and so I simply can’t imagine getting the time to sleep much less time to add a steep learning curve to do what I can already do in webforms. My secrets or approach, if you will, for using webforms depends on the markup control needed. when I need complete control over the mark up I find using the old fashioned data reader methods that load data into plain HTML controls gives me complete separation and pixel perfect (well perfect is relative to time allowed) control. for more grid and tabular data I use sqldataadapters or stored procedures with grids and data controls. However, rarely do these grids not need customization that will tempt you down a findcontrol path you don’t want to typically take. so my secret for using data controls in visual studio is to first see if I can use SQL express manager as a tool to write more complicated t-SQL statements that can carry as much of the business logic as possible. by using t SQL case and cast statements that prepare data before it gets pulled into the gridview or formview by the sqldataadapters I feel I reduce the frustration found in customizing prebuilt grids. For instance
    It’s common to want a data gridview control that has a column with a hyperlink that is dynamically built using concatenation of page names plus a record Id which the data controls can handle, but what about other categorical or related parameters you need to send along as well? This is where SQL can be used to concatenate strings and additional parameters to ad to the URL. I cannot speak to mvc benefits but I don’t find the kind of explanations I need to move forward with the little time I might get to play. Like how are methods captured in mvc using vb.net? If Microsoft could build two identical acme websites that were robust and diverse demos that used a northwinds SQL driven backend and had a bootstrap front end in both webforms and mvc then I think we would be getting somewhere. Having non real world examples of just mvc without a forms equivalent along with them just does not answer the real questions I have. Which is not how does mvc work, but how does it improve what I already know how to do? Plus the propaganda which can come across as either better than thou which tempts me toward shame or more often The I am a spoiled brat with a cush job where I get overpaid to brag about theoretical cool trends and impracticalities, that tempts me to get snooty does not help the mvc case. Especially since there are solid arguments to simply ignore mvc. But I wouldn’t not do what I do if I wasn’t a curious soul. I just think Microsoft is not wanting to move webforms developers to mvc. If they did you would have better migration examples and stronger arguements. I remember when XML was going to take over the world and HTML and JavaScript were the big losers. If I am going to dig in, why not Xcode or….

Leave a Reply

Your email address will not be published. Required fields are marked *

*