Home
About Me
Browse All Posts
ASP.NET WebForms DO NOT SUCK!
published on 1/13/2009 7:36:58 AM
It is really pathetic to see people coming out of their caves and slashing ASP.NET WebForms since the arrival of the ASP.NET MVC Framework. Check out
this
post. This guy has no idea what he is talking about. I agree that ASP.NET WebForms has problems which revolves around ViewState, Postback and hard to test user interface layer. But look at the help it has provided you over the years. The rich library of UI controls, validation, code separation, ViewState (yup that is also your friend) etc. It has saved you countless number of hours trying to implement those features by yourself.
Let's take a look at points this guy is making:
1)
Other web developers assume you're inferior:
WTF is that even mean. No one assume you are inferior. I have programed all my life in WebForms and I have never experienced this issue. There is nothing wrong working with WebForms. It is not about being the cool kid on the block it is about getting the work done.
2)
ViewState:
Yes, ViewState is a problem but there are many solutions. First, you need to find out why your page is generating 1MB of ViewState. There might be some controls which are not using the ViewState at all. You can easily turn ViewState off for those controls. If that is not a possibility then compress your ViewState and inject into the page.
3)
ID Insanity:
Yes, ID insanity is a problem. But again there are many solutions. As, you pointed out this is common when nesting different controls in a container control. I have been working with GridView controls for a while now and have faced and solved these issues. Also, be patient as this will be solved in the new version of ASP.NET.
4)
Html Abstraction:
You can always write HTML in WebForms just switch to the HTML view and start typing. I love the separation of the HTML code from my C# code. Although it becomes hard to test but this is the trade off for separating your C# code from your HTML code.
5)
Postbacks Everywhere:
Postbacks and ViewState goes hand in hand. You are only thinking in the negative direction about Postbacks. Think of all the goodness it provides when ViewState handles all of your server control state and perform all the plumbing behind the scene.
6)
Getting Data to the Client:
Seems like you have never called a server side method using JavaScript. All I can say on this is to try it yourself. It is not even hard.
Here
is a good post to get you started.
7)
Ugly URL's:
Although the Routing DLL is now public and you can use it without having to use the ASP.NET MVC framework but making URL's pretty was done even before that. Just search for URL Routing and you will find many articles using HttpModules and performing the same action.
8)
Codebehind:
I love codebehind! It separates what I am writing in HTML to what I am writing in C#.
9)
Feels Wrong:
H mm! There is nothing I can do about your feelings! :)
My conclusion is that don't start critisizing something because something new came to the table. I love WebForms framework and I equally love ASP.NET MVC Framework. There are lots of websites which have used WebForms framework with great success. People have been using ASP.NET since 2002 and I am sure they were able to tackle all the problems that you have listed and created some amazing applications.
Did you like this article?
Submit
by Scott Galloway on 1/13/2009 1:32:36 PM
Nice post! Should also add that we'll have 'native' support for WebForm routing in 4.0.
by Andrew Hallock on 1/13/2009 2:17:56 PM
I really liked your article "Developers Estimate NOT Managers," but I completely disagree with you here. ASP.NET MVC isn't anything new, just MS' playing catch up. MVC has been around for ages, and so has the original and better .NET implementation: Castle Monorail. So nothing new has come to the table. Web Forms has a broken conceptual model (treat web apps as if they were desktop apps) and its use should be discouraged. Switch because MVC is the better model for web applications, not because of an MS-authored .NET version.
by Prajwal Tuladhar on 1/13/2009 8:19:30 PM
I have a feeling that you came from desktop environment so you love Web Form. If you have come from pure scripting or conventional web world like Rails, PHP you would certainly understand why Web form sucks. One can also take some idea from the fact that MS and .NET community has given much more focus to MVC approach than Web form for quite some time. MS ha finally understood one can not create testable and clean code with Web form.
MVC is not just about URL routing but using your URL as a resource based on REST principle. And I am hearing that .NET 4 has focused more on REST than SOAP.
And ASP.NET MVC may be new, but MVC is not new. It has been here since 1970 and will continue to exist even after some time Web form disappear.
And I guess you have launched http://www.refactorcode.com/ few months ago (source: your about me section). Wikipedia defines Code refactoring as the process of changing a computer program's internal structure without modifying its external behavior or existing functionality. This is usually done to improve code readability, simplify code structure, change code to adhere to a given programming paradigm, improve maintainability, or improve extensibility.
Using web form if you feel you can really maintain and write test driven code then I guess you have not understand what refactoring really means!
by Mohammad Azam on 1/13/2009 8:31:48 PM
@Andrew Hallock,
The MVC pattern is very old. The ASP.NET MVC in brand new actually it is not even released. I understand the power of MVC framework but we cannot deny the power of WebForms. The powerful controls and ease of use.
I think the main power of Webforms are the controls. Yes, there is no testability but hey if you want you can always go the MVP route using Webforms.
by Mohammad Azam on 1/13/2009 8:35:02 PM
@Prajwal,
Thanks for your comment! Actually I am coming from pure web development background. The MVC pattern is old but the framework is new. Actually it is still in BETA. I have nothing against ASP.NET MVC framework but I cannot deny the power and ease of use using the Webforms framework. Just think for a moment that how your development will sky rocket when you are using rich controls. Yes, webforms have problems but hey over the years we have found the solutions. Just remember every application or frameworks has problems but there are always solutions.
by Swami K on 1/13/2009 11:18:06 PM
Hi Azam:
Nice, detailed and to the point reply. I full well agree with your views. Webforms framework does is indeed powerful and easy to adopt . Webforms does have problems but there are workaround as you mentioned in your article
Regards,
Swami K
http://swami-k.blogspot.com
by Kam on 1/14/2009 7:33:29 AM
Couldn't agree more. I have absolutely no idea why people are slating webforms. I shudder at the thought of having to implement all the things that viewstate gives me for free (mostly). Code behind is an absolute god send and it's unbelievable that people are now considering coding in the "old" way again where it is seen as fine to intermingle HTML and code (Ok, you don't have to but it pretty much lets you get away with it). Having been coding web applications since the mid 90's from mainframe's to .NET i've seen the whole evolution of web frameworks. ASP.NET MVC whilst neat in that it allows the use of jQuery and other client side frameworks is all well and fine if you have time to spare but it simply doesn't come close to the productivity of using web forms. I've looked at the amount of work that has to be done to implement something like say gridview functionality in MVC and it is simply not worth it. The likes of Phil Haak keep saying things like "yeah well it's your job". NO!. My job ultimately is to come up with a working/efficient product that is as low cost as possible that meets specifications for my company or client. If that means doing it in less time with webforms then webforms it will be. Ultimately time to market is what really differentiates ASP.NET. Get rid of that and the only advantage i can think of is C# (the .NET stack whilst great is more than equaled by OpenSource and freely available products). But then is C# so massively superior to JAVA? i don't think so. That being the case why shouldn't clients switch to a "free" stack be it JAVA based or LAMP etc?
Ultimately MVC has its place and is shiny and new but i'm sure there will be a whole load of miffed people if webforms gets second bite at the cherry. Alas i think with the whole thing headed up be Haak i'm thinking that's the way it will go. Give it a few years and we'll be looking back and saying "what the hell were we thinking?"
by Mohammad Azam on 1/14/2009 7:45:42 AM
@Kam,
Yes, I agree! Actually I have always considered ASP.NET MVC Framework targeted to the developers who want to code everything themselves. This gives them more control over what they are trying to achieve. There is nothing wrong with that and I admire them. I have not implemented a solution in MVC framework so I cannot judge how difficult it would be to implement complex UI controls. I respect both the frameworks and I think both have strengths and weaknesses.
by Scott Galloway on 1/14/2009 12:07:54 PM
To be honest the 'WebForms' versus 'MVC' argument is kinda funny to me. My background is hardcore Web Development (back to plain ole C with CGI). I 'own' WebForms in the ASP.NET team but I also love MVC. It's not a case of the two competing for the same market, devs who want to use MVC are typically looking for more control than is easy to achieve using WebForms; you have to write more code using MVC but you also get a 'cleaner' model (far less abstraction than we use in WebForms).
WebForms is an older framework at this point, are we looking at improving things in vNext...hell yeah! Is WebForms going away...NO. Our job is to make it quicker for you to write web apps which get your job done, it's also to keep you ahead of the curve...WebForms and MVC both have a place in this aim.
by Gernot Kogler on 1/15/2009 4:00:09 AM
Hi Azam
ASP.NET MVC ist not brand new, it's a copy of the rails framework (without the elegance of rails, thanks to ruby).
I develop with ASP.NET and Rails and know them both very well. And yes, ASP.NET sucks big time.
Did you eyer ever try another modern web platform besides ASP.NET? If not, I would highly recommend to try one ;-)
by Mohammad Azam on 1/15/2009 7:15:04 AM
@Gernot,
Thanks for the comments. Actually I am talking about ASP.NET MVC in specific. We all know that MVC pattern is very old. But anyway, yes I have worked with Rails and it is also a good framework. It all comes down to how much help you want to or not want to leverage from your framework. If you want everything to be done by you (I mean UI) then rails and MVC is a good choice (also testing). But if you want to use a push from ASP.NET then webforms is good.
I cannot answer which one is better since they provide different features and bring different food to the table.
by Thomas Hansen on 1/16/2009 4:47:20 AM
Great writeup Mohammed, in fact I wrote a counter-blog myself against that same blog over at; http://ra-ajax.org/mythbusters-busting-the-myths-about-webcontrols.blog
by Thomas Hansen on 1/16/2009 6:33:19 AM
@Kam
***AMEN***...!!!!
Wow that was a good comment...! :)))
by JD Conley on 1/16/2009 10:35:44 PM
The fact of the matter is, the ASP.NET MVC framework meets my needs better.
I'm not immature with a high school mentality. Some people need to get a sense of humor. :) I also live in the startup world building web based products. Our requirements of a framework are 99% different than your average internal business application developer.
I use Webforms all the time. We have games built on it. They're RAD at its best and highly productive. But, I do still find myself scratching my head looking at code that generates code that calls other code, and wondering why I didn't just call the code to begin with. The abstractions are nice sometimes, but a lot of the time they just seem silly.
I also love Viewstate. Managing state in a web app sucks. But the fact that you have to know the ins and outs of it to make sure you're building well performing apps is often frustrating, especially when you're training new devs. Postbacks annoy me because they are overused and destroy the back button. It's so easy to throw a linkbutton on a form to do something that really should be in a querystring that it's become an epidemic.
by SH on 2/18/2009 8:35:06 PM
To each his own.
I still prefer to code in vbscript or php.
MVC is the first thing in .Net that looks worth using in a production environment. I believe that it and jquery will transform the way complex apps are built for the next few years.
Don't get me wrong, I've seen some amazing things done with webforms. But I also know how painful it was to get those things to work. MVC , as so many others have stated, is a good way to ease that pain.
by manolo on 4/30/2009 8:53:30 AM
I agree with you, that some of the mentioned critics aren't really that down-to-earth grounded, like #1, but i do have something regarding some of the problems with viewstate, ugly id's etc; even if they're are solved already, or if there's a not so known method of dealing with these issues, the fact that they're
1. Not right out of the box: this means you have to do a "workaround" to get for example, nested controls ID'ed prorperly, or Viewstate not weighing 20MB, etc
2. Are to be solved in future versions: so yeah in .NET 4.0 much things are to be solved, but if theres already some framework with things working why should we stick to something fundamentally wrong that "will be better in a future version". Probably in some years ahead the paradigm of Web develoment will change, HTTP protocol will be like coding for desktops apps or whatever, but we need solutions now, not something "to-be-implemented".
So thank you for openning a discussion of the uselfuness of this framework that, just right now has my head scrathing probably because of lack of experience, but also because having worked with other frameworks in php and ruby, i now have to "unlearn" things that i considered good practices, just to get on this easy development trend.
Name:
Name:
Email:
Comment/Feedback:
2+2=
Latest Articles
Implementing Blog Using ASP.NET MVC and MongoDb
Implementing Business Object to Documents Converter for MongoDb
Persisting Hierarchical Data Using MongoDb
Introduction to MongoDb Database
Ajaxify your ASP.NET MVC Application
Latest Videos
Persisting Objects in the MongoDb Database Using C# Driver
Understanding ObjectId in MongoDb Database Using C# Driver
Saving Nested Documents in MongoDb Using C# Driver
Interacting with MongoDb Using C# Driver
Introduction to MongoDb Database
Latest Podcasts
IPad, EStudy and Rake
Mohammad Azam Loves Lego Mindstorm
F# with Ryan Riley
One Cucumber with IronRuby Coming Up!
Elijah Manor Tweets Knowledge
Technorati Profile