in

 

GrabBag<T>

ASP.NET: officially unmaintainable

Recent forays back into "classic" ASP.NET (i.e. not MVC) have me completely convinced that ASP.NET is inherently unmaintainable.  Not partially convinced, not on the fence, but completely convinced that the presentation layer of ASP.NET cannot be maintained in any reasonable manner.

I remember a presentation on MonoRail some time ago, where the presenter asked the audience "how many of you work with ASP.NET in a professional manner?"  A hundred or so hands went into the air.  The presenter then asked, "Now keep your hands in the air if you actually enjoy working with ASP.NET?"  Only a handful of hands stayed in the air.

Now, obviously some peer pressure skewed these results, and it wasn't a double-blind survey, but it was clear that developing with ASP.NET is a frustrating experience.  My own personal frustrations include:

  • The ridiculous amount of time I spend in Reflector trying to figure out why things that are supposed to "just work" when wired up "just don't"
  • Not having control over the HTML that is spit out.
  • Trying to do anything with AJAX or DHTML with the insane control names
  • That ASP.NET is the king of leaky abstractions

I try to make the ASP.NET layer as thin as possible, so that the bulk of the application is maintainable.  But even in a MVP setting, the V is still dreadful to maintain.  In the end, HTML is the application, not controls.  HTML is what gets delivered to the client, not crazy post-back event server nonsense.

I knew early on I would have troubles with ASP.NET, back in 2003-4 or so, when I had to use Reflector to get even basic scenarios to work with a DataGrid.  Debugging why control event isn't getting fired pushes my sanity to the brink.

It also doesn't help the fact that I've never seen an ASP.NET application with unit tests for the code-behinds.  Without tests, your code is unmaintainable.  Since you can't unit tests code-behinds, you have an immediate charge in your technical debt.  For this reason, I can't really recommend using plain ASP.NET, almost ever.  Using a real MVC framework in MonoRail was not only a breath of fresh air, it felt like I was the frog getting rescued from the pot of boiling water, never noticing the temperature going up.

So do yourself a favor, take the one week MonoRail challenge.  Try building one aspect or one story in MonoRail, and see how it feels.  Personally, it felt like a crushing weight was finally lifted.  You might feel the same, and with a one-week spike (or even one day), what have you got to lose?

Published May 18 2008, 10:13 PM by bogardj
Filed under: ,

Comments

 

Bryan Reynolds said:

LOL!

I sure feel this way sometimes.

May 19, 2008 12:17 AM
 

Dew Drop - May 19, 2008 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop - May 19, 2008 | Alvin Ashcraft's Morning Dew

May 19, 2008 6:54 AM
 

Michael said:

Just to be clear, you're actually referring to WebForms not ASP.NET?  Right?

May 19, 2008 8:10 AM
 

Christopher Bennage said:

I have decided that I will not go back to ASP.NET (WebForms) unless someone pays me _gobs_ of money.  I'm a big fan of MonoRail and looking forward to the advent of ASP.NET MVC.

Funny enough, I did some "classic" classic ASP not too long ago, and found that it was as painful as I had remembered!

May 19, 2008 8:55 AM
 

bogardj said:

@Michael

Yes, "WebForms".  Thanks for the clarification!

May 19, 2008 10:20 AM
 

James Gregory said:

Preaching to the choir... I'm very tempted by your MonoRail challenge though!

May 19, 2008 2:07 PM
 

mattflo said:

Aha, that's why I'm so unmotivated right now:  Web forms foo.  And it is totally a boiling frog scenario.  I had no idea of the pain.  In fact, I remember when I thought web forms were really cool. Hmm... MonoRail.

May 19, 2008 3:28 PM
 

Arjan`s World » Blog Archive » LINKBLOG for May 19, 2008 said:

Pingback from  Arjan`s World  &raquo; Blog Archive   &raquo; LINKBLOG for May 19, 2008

May 19, 2008 3:58 PM
 

Jeffro said:

Have you had a chance to compare MS MVC with Monorail yet?  I'd love to hear about the pros/cons between the two.

May 19, 2008 4:33 PM
 

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

May 20, 2008 12:27 AM
 

Will said:

I'm currently taking the MVC challenge.  It does feel a lot lighter than ASP.NET...

May 21, 2008 8:08 AM
 

Mark said:

Works On My Machine

May 21, 2008 9:02 AM
 

Matt said:

I would have been one of those people who put their hand up in that conference.

Sure, the Page is a leaky abstraction, but I work in a place where we make user and server controls for our designers to use in our sites. The level of functionality you can encapsulate in a server control for extremely easy use is pretty much unmatched by any other web technology I have used before.

If I were using *Views with *DataSources I would probably agree with you, but WebForms do address a relatively large problemspace. Maybe not as big a one as MVC style frameworks do, but it is not useless.

May 21, 2008 9:11 AM
 

chadmyers said:

I'm offended by this post. I have spend a significant percentage of time in my career studying and memorizing the ASP.NET Page Lifecycle and i know all the intricacies of CreateChildControls and which events fire when you add a control to the Controls collection.

How dare you assault the castle of knowledge I have built!

;)

Seriously, though, I have a friend who is still running a significant ASP app and I looked at his code again recently and I'm thinking that ASP as a view engine with .NET behind is looking pretty darn good right now.

That's essentially what ASP.NET MVC is, I guess.

Anyone ever think: "Wouldn't it be easier if you could just give me three Dictionary<string,string>'s:  Request, Form, and Session and an output stream and I can take care of the rest?"

I guess that's what CGI is and that didn't work out too well.

May 21, 2008 9:26 AM
 

Tim C said:

Convince me that webforms sucks. Show me code that sucks / is impossible to maintain in webforms that is freaking awesome / easy to maintain in monorail.

May 21, 2008 9:53 AM
 

Alex said:

Oh yeah tell my boss that i will take n ( 2, 3 ?) times more to do a data entry app. He sure will love to know about viewstate mess and stuff.

People want applications and want it fast. Webforms do.

May 21, 2008 9:56 AM
 

Seth Petry-Johnson said:

I agree that WebForms makes it so easy to commingle presentation and business logic, that unit testing a web application is difficult at best, and page lifecycle issues can be nightmarish. The Postback model is great for simple pages, but I think it quickly becomes an albatross around the neck of larger applications.

On the other hand, I see a lot of value in the extensible WebForms component model. At my current company we have a number of reusable user controls that improve consistency and maintainability. Is there a similar story for creating reusable UI components in MonoRail or ASP.NET MVC?

May 21, 2008 10:46 AM
 

ReTox said:

> Trying to do anything with AJAX or DHTML with the insane control names

I would also note that this madness with IDs makes CSS also painful

May 21, 2008 10:46 AM
 

bogardj said:

@Seth

Depending on the view engine used, they all have some concept of view components.

May 21, 2008 11:39 AM
 

Andy said:

I second this.

Convince me that webforms sucks. Show me code that sucks / is impossible to maintain in webforms that is freaking awesome / easy to maintain in monorail.

Not every app has to be a pillar design and technology

May 21, 2008 11:43 AM
 

bogardj said:

@Alex

Fast is relative.  Fast works for about 2 weeks, then fast becomes slow.  I'm not working on 2 week disposable apps.  I'm working on apps that have to live for longer.  In that case, since 60-80% of development cost is in the maintenance phase, after initial development, I'll optimize production towards that end.

That means a maintainable ecosystem.

In any case, I've found I develop RAD apps faster in MVC style anyway.  Check out all of the RoR apps out there, those are MVC and the conventions lead you down the right path.

May 21, 2008 11:43 AM
 

Tim C said:

>I would also note that this madness with IDs makes CSS also painful

Why? If you are intent on using CSS to apply to IDs of elements, then wrap your control inside a div/span that has that ID. I'd hardly call that painful...

May 21, 2008 11:45 AM
 

chadmyers said:

@Tim C:

Now I have to do EXTRA work just to get around limitations in WebForms.

Whatever short-lived productivity gains I may have accomplished during initial development start getting eaten up by stuff like massaging my HTML in order to get around the ridiculously_long_control_id's.

With [pretty much every other web framework] I don't have to do this.

May 21, 2008 12:24 PM
 

superjason said:

Sounds good, I'm taking a look at monorail right now!

May 21, 2008 1:23 PM
 

Onur Gumus said:

I am a senior asp.net web dev. I haven't programmed with monorail but I peeked and know the idea. I also have developed full blown applications with rails and flex.

Web Forms Cons:

Hard to unit test: You have to use MVP like strcuture. Which can be overkill

Viewstate: View state is a complex mechanism and can slow down your application

Page Life Cycle: This is also very complex and hard to learn

Generated HTML is untouchable: You have no control over the generated HTML. This makes very difficult to use 3rd party frameworks

Pros:

Distance from HTML: I never liked Html so asp.net gives some distance from html. With monorail you have to type a lot of html as well as asp.net mvc. This was also the case I quit from rails. Html is crappy and must be abtracted

Component and Event Driven: This is a great issue of ASP.NET Web forms, you can encapsulate every peace your page into sub components. This makes your application very maintenable. With MVC you would have only html snippets . And although ASP.NET MVC supports web controls not the post back ones

Ultra easy ajaxifying: You can make  any of your custom component ajax enabled just by putting it into an update panel. Same effect is dificult to achive with MVC farmeworks even if you use JQuery, ExtJs, dojo.

Ultra powerful: Have you checked ASP.NET Ajax Client Library. The logic behind is very good. Most ajax libraries are focused on widgets or communication stuff. MS client library is for interconnecting any javascript library with your components very powerful

Built in caching: Very easy partial caching or full caching

To sum up, I still prefer Web Forms, and I can't see any better technology despite the criticism. I can understand the criticism since Web forms is hard. I mean real hard. It is not as easy as ms promised or shown in their demos. when you dive in, you can be frustrated with the complexity which is why most people are disappointed. But that doesn't change that web forms is extremely powerful.

Try to do an ajaxfied gridview with internationalized sorting support + editing+ deleting. No even extjs can't do it

May 21, 2008 2:47 PM
 

Kris said:

I think ASP.net is great to work with, maybe that's just me. The learning curve is a lot higher than classic ASP or PHP (I haven't used MonoRail) but once you understand things like the page lifecycle (events) and a number of the other concepts of ASP.net, it becomes a great language to develope in.

May 21, 2008 3:30 PM
 

Chris Pietschmann said:

I disagree. I came to ASP.NET from Classic ASP/VB6 and I really enjoy developing in ASP.NET more. Yes, there's a bit of a learning curve compared to Classic ASP, but the development platform is extremely better.

And, as for working with controls using JavaScript/AJAX; all you have to do on the server to get the client-side ID of the element on the page is: [control].ClientID

May 21, 2008 4:20 PM
 

bogardj said:

@Chris

ClientID is non-deterministic, which makes it tough to use CSS or the myriad of javascript frameworks out there (jQuery, prototype, etc.)  I know that it's there, but it's a kludge.

May 21, 2008 6:59 PM
 

Dave said:

I'm sick of people who don't understand webforms, and then complain about it.

A poor builder always blames his tools.

May 22, 2008 6:34 AM
 

bogardj said:

@Dave

A poor debater discredits the opposite point of view, rather than address it directly.

Six years of understanding WebForms is enough.  There are better models out there.  If you chalk up my arguments to lack of understanding, your biases have led you to gloss over any contradicting analysis.

May 22, 2008 7:35 AM
 

Aaron Zalewski said:

I think I worked into ASP.Net WebForms backwards from the traditional path.  Most Sr. people I've worked with began as backend coders and worked forward (towards the UI).  Thier frustrations sound a lot likes yours.  I started out as a 'wet behind the ears' DHTML developer and worked towards the lower level functionality my peers were experts in.

I am not going to defend DHTML as a simple, straight foward medium, but I've plumbed the depths of WebForms to the point that I find them easy.

Re: Control over the HTML output.

True, this is not accessible from the 'out of the box' controls, but if you create your own class that inherits, say, RadioButtonList and overload the Render method, you can have complete control over the output.

I understand the frustration with the Control Event Model, but it's just part of working with a disconnected layer like the web.  Are there better implementations?  I am sure.  I seldom have to resort to using Reflector, the debugger + online info has worked well for me.

AJAX and DHTML - see above.  That's what I started in, I don't find it difficult anymore.

Page as a leaky abstraction later.  Ok.....I guess.  I just haven't run into where this has been a significant detriment.  When you analyze any framework down to it's lowest levels, I guarentee you will find thing implemented in a less than optimal way.  That is the trade off when using a framework that abstracts away complexity.  

May 22, 2008 10:56 AM
 

Glenn said:

Wow, after reading this post I can now understand why some people think the ALT.NET guys are a bunch of douche-bags.  Spurious inflated claims that aren't even well supported.  No wonder the ALT.NET community gets some eye-rolling when they have people like you claiming to represent them.  

ASP.NET is officially unmaintainable?  

Truth ~ Jimmy Bogard doesn't like ASP.NET's WebForms model.  It may not fit well into what he's doing.  Or it may be that he's having a hard time learning it.  Either way the fact remains that thousands of people and projects use ASP.NET for many different things.

Want to know why all those people raised their hands?  ...Exactly because it is successful.

May 22, 2008 11:18 AM
 

bogardj said:

@Glenn

I'm tempted to just delete the comment...I had the courage to use my full name and attach it to my ideas, it's unfortunate that you did not.

Thousands of people use it _only_ because it's there.  They raised their hands because it was at a .NET user group meeting.

I never said WebForms isn't successful.  It's just the wrong abstraction of the web.

Again...shallow analysis has led you to the "oh geez what a complainer...he must not understand it" observation.  My contact information is in the "Contact Me" link.  I'd be happy to engage in a real conversation, if you like.

May 22, 2008 1:24 PM
 

bogardj said:

@Aaron

If I've overloaded Render, haven't I already lost?  What value is the control providing?  RadioButtonList is nothing more than a for loop in the template for HTML INPUT tags.

Reminds me of the conversation on Haack's site - "We need an MVC Repeater" "No, it's called a for loop".

May 22, 2008 1:36 PM
 

La impedancia de los WebForms | Climens Codelog said:

Pingback from  La impedancia de los WebForms | Climens Codelog

May 22, 2008 5:04 PM
 

Code Monkey Labs said:

General Microsoft Migrates MSDN &amp; TechNet to Hyper-V RC0 : Microsoft has eaten its own dog food yet again by migrating the web servers hosting MSDN and TechNet to virtual machines running inside Hyper-V RC0. Combined, the two sites serve more than

May 23, 2008 12:01 PM
 

The Inquisitive Coder » Blog Archive » Weekly Links 5 said:

Pingback from  The Inquisitive Coder  &raquo; Blog Archive   &raquo; Weekly Links 5

May 24, 2008 2:30 AM
 

Malusi said:

I use Asp.net quite extensively and have built and developed many applications using asp.net since .net 1.1

Just use JQuery. Learn it, use it and find a way to make it work nicely with everything else. When you hit a snag or challenge, research and develop a solution. Thats development. Move on and do the next thing on the list...

May 24, 2008 8:45 PM
 

ADO.NET programming said:

"then fast becomes slow". Agree. Additionally I personally think that asp.net is too much of finding out when and where to do things. I.e "not in Page_Load, you must do that kind of thing in Init, or CreateChildControls" etc.  

Last, at least to me the cost of the pagehandler and viewstate simply isn't worth it, I am currently looking into my own lightweight asax handler using another sort of template engine for gui.

May 26, 2008 4:31 AM
 

Wöchentliche Rundablage: ASP.NET MVC, Silverlight 2, C#, Entity Framework, WPF, Javascript | Code-Inside Blog said:

Pingback from  W&ouml;chentliche Rundablage: ASP.NET MVC, Silverlight 2, C#, Entity Framework, WPF, Javascript | Code-Inside Blog

May 26, 2008 3:30 PM
 

Weekly Links: ASP.NET MVC, Silverlight 2, C#, Entity Framework, WPF, Javascript | Code-Inside Blog International said:

Pingback from  Weekly Links: ASP.NET MVC, Silverlight 2, C#, Entity Framework, WPF, Javascript | Code-Inside Blog International

May 26, 2008 3:31 PM
 

Joe Cotellese said:

I've done development in ASP.NET and MonoRail. I did enjoy MonoRail however for my last web project I decided on django and enjoyed the experience even more.

June 10, 2008 11:30 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About bogardj

I'm a senior consultant with Headspring Systems in Austin, TX. My focus is using .NET technologies together with Agile methodologies. Back in 2005, I drank the Agile punch and haven't looked at a waterfall the same since.
Copyright Los Techies 2007. All rights reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems