May 7, 2008
ASP.NET Encourages Procedural UI Coding?I mean, why don't we just go back to writing our applications in FORTRAN?
The concept of an object oriented framework for implementing web user interfaces seems to have eluded Microsoft yet again. As always, it falls just short of allowing us to write the kind of neat, OO code we'd like to and drags us back down into the depths of magic strings and magic numbers and all manner of procedural nastiness.
The problem is that we can't do smart things like attach references to internal application objects to our UI components which are persistent across multiple user requests. Of course, web applications are supposed to be stateless, so you'd have to do something under the covers to map an object reference in view state to the actual instance it refers to (say in session or applictaion state), but is that really asking too much to have the framework resolve those references for us?
I just led a poor pair of developers down a blind alley, thinking - in my usual naive and techno-illiterate way - that ASP.NET would allows us to easily associate a concrete command object with a list item in a drop-down box. It transpires I was talking bollocks. (No, really, it does happen from time to time.)
We found ourselves tied up with magic keys and magic text values, and having to look up the command instance we want from a dictionary; and suddenly I'm having COBOL flashbacks.
It sucks. So here's a tip for web UI framework developers: having knocked up a couple myself, I know that you will want some transparent way to resolve references between your application's objects and UI framework objects. And I know you'll want it to work with your session state management solution. That's a given if you don't want to end up regressing to the days of prehistoric coding where the user clicked a button and we used the index of that button to look up the name of the object that handles that event. That went out with Visual Basic 1.0, didn't it?
Obviously not :-(
Posted 10 years, 2 months ago on May 7, 2008