web 2.0

ASP.NET WebForms vs. MVC

At my first programming job, I remember sending an application to a customer via FTP. In order to make the process easier, I downloaded a feature-rich FTP client and started uploading files. I remember my boss, Cliff, came into my office and took one look at my monitor and said "You kids and your fancy GUIs". This was Cliff's way of saying that I really did not need to download a fancy program in order to upload a single file.

On a similar note, when it comes to ASP.NET I often feel that Webforms masks developers from the real truth about real web development. If Cliff was here, he would probably say something like "You Kids and Your Fancy Webforms!".

I remember the classic ASP days when I would develop custom scripts to create a data grid. I spent hours adding features like sorting and paging. There was quite a bit of code involved and I took the painstaking steps to try to reduce the amount of roundtrips to the server and to optimize the HTML that was generated. Nowadays, with Webforms you can drop a DataGridView control onto a form, enter a select statement and you are done. I really like the way that Rob Conery describes Webform development on his blog:

WebForms is a lie. It's abstraction wrapped in deception covered in lie sauce presented on a plate full of diversion and sleight of hand. Nothing you do with Webforms has anything to do with the web - you let it do the work for you.

Now don't get me wrong here. I really appreciate tools that allow me to focus on the business logic rather than all the non-value added issues. However, my fear is that we are going to end up with a generation of developers who do not understand basic things like binary code or hex. With tools like Visual Studio we are developing at such a high level that we lose sight of the fact of how things really work under the covers.

One of the things that I really like about ASP.NET MVC is that we have gotten away from the PostBack and "Magic State" paradigm. There is a clear line between what causes a post back and what does not. Furthermore, If you want to maintain state for a page then you explicitly need to do it in your code. For these reasons, I feel like MVC has once again given me back full control over my HTML.

Let me end this post by stating that these are only my opinions. I am not saying that Webforms is better than MVC or vice-versa. After all, there is nothing stopping you from adding a Webform to a MVC project. In some cases it may be required (such as adding a SSRS Report Viewer to a web application which requires Postback). I guess when it comes to coding I am a control freak. There are times when it is nice for a tool to do the work for you as long as you have a true understanding of what really is happening behind the scenes.

Comments

Anonymous , on 12/17/2009 2:29:24 PM Said:

Anonymous

I'm tired of changing paradigms of years ... see all the good open source projects over the internet ... asp.net ? nothing ...

Anonymous , on 12/17/2009 2:29:24 PM Said:

Anonymous

"my fear is that we are going to end up with a generation of developers who do not understand basic things like binary code or hex"

I'd rather say "my hope is that the next generation of developers don't have to understand basic things binary code or hex"

Each advance in software development hides some of the complexities. Each cycle gets us a step forward and makes our job easier (in theory, because we deliver more and more functionality each time).

MVC is a step back from webforms.
For some people this is a good thing, for others this is a bad thing.

I personally am disappointed in MVC. It needs to do some growing up before it can be an alternative for the RAD development of webforms.

For smaller projects, or projects coming from classic ASP I would be tempted to use MVC.
For larger projects, I'll keep using Webforms.

Michael Ceranski , on 12/17/2009 2:29:24 PM Said:

Michael Ceranski

When I went to the MSDN conference last month MS claimed that WebForms was not dead. They stressed the fact that MVC was not a replacement for WebForms. Just because you create an MVC application does not mean that you can not utilize Webforms within it. I actually have an application which is a hybrid between MVC and webforms.

I agree with the fact that the post back mechanism that drives WebForms was poor design. However, most of the problems related to postback could be avoided  by a educated and/or disciplined developer. Unfortunately, most people have the mentality that, if it compiles it is finished.

I have not experimented with GWT but I don't think that Microsoft really needs to be concerned. Especially if they can accomplish the "Write Once, Run Anywhere" dream. In any case, Microsoft has gained a strong following of developers over the years and as long as they do not royally screw it up, then they will continue to gain marketshare.

Anonymous , on 12/17/2009 2:29:24 PM Said:

Anonymous

webforms are dead. ms knows that webforms is a bad paradigm. they make, since the framework 1, bad web developers...i dont think they are in time to change future...google is here, with they GWT, and  a "wave" that ms cant stop anymore. im a asp.net developer, but i think, times are changing...

Hirephpdevelopers United States, on 1/13/2010 8:09:56 AM Said:

Hirephpdevelopers

Here given nice details about the asp Mvc structure vs asp web form. There are lots of information containing in this article.

Comments are closed