5 Useless things, used often in web apps

Except for a select few, I get the feeling people use these, just because they are there. Even more-so than Microsoft cramming them down programmers’ throats. Let’s leave aside the fact that Microsoft encourages its developers to not think when designing (especially web) applications and instead use their own semi thought out solutions, why is it that developers have a tough time seeing these features for what they are? Useless bloat!

When I say useless, I mean for 80%-90% of cases out there, but still implemented as default because it’s a “Best practice”. I wonder if developers have an equivalent for a Kuik-E-Mart guru who lives on top of a mountain where they get this information.

And without further ado :

ApplicationName

This little menace causes more trouble for developers and end users than any other “feature” in ASP.NET 2.0+. Why is it there? What’s the point? Aren’t the vast majority of users more likely to have just one application.  And why can’t the existing apps use the root virtual path (“/”) when not specified? Because the programmers who wrote it believe their users will have multiple web apps running on multiple virtual directories.  Which is not the case, as most of us living in the real world would know, with many if not most web hosts.

What’s worse, Visual Studio and Web Developer Express insist on creating your test run on a virtual directory (which is a pain to get rid of in Visual Studio), that will obediently be used by all the default SQL providers. Then you have the delightful emails claiming “your program doesn’t work” because you forgot to change the applicationName in the web.config or they forgot to change it back.

Aren’t you more likely to use a seperate database for your web app anyway? Do we even need an ApplicationID in our database?

AJAX

“What? They’re using their own libraries? You say, they work across all browsers and Operating Systems? And they don’t need to be installed, just uploaded and called on a few pages? And they’re 1/8 the size of our code?! The bastards!!! We’ll show them!! From now on all ASP.Net pages will have AJAX by default!”

GUID

Giant Ugly Interfering Demon, also known as a Globally Unique Identifier, which doesn’t even make sense since it isn’t global anyway or, for those of us who realized the Internet existed before IIS, UUID (Universally Unique Identifier).

The only conceivable use for this thing is when you have to replicate your database across multiple servers. But since most of us are content with one database on one server, why is this monster forced down our throat? All it does is add extra complexity to the Data Access Layer.

Even MySQL doesn’t have to put up with this kind of nonsense.

I had to salvage a botched application for a non-profit organization recently, and I couldn’t imagine the level of garbage that was introduced into the DAL. The previous programmers allegedly “rescued” this program from SQLite (ironic, since I consider SQLite to be a far superior product in many ways than almost all of the free and non-free products out there) and converted it to SQL Express.

Here’s a little food for thought…
I need a way to uniquely identify a user.  The users will have a unique ID and a unique user name.  As such, the user name will be matched against the database to see if there are any duplicates. The ID will always be harder to remember than the user name as it is globally unique and non-incremental. The ID will never be referred to in the open anywhere in the web app (I.E. /users/username.aspx).  Other users can, thus, type the URL into the browser manually, if they are unsure and the app will search the DB if there are no exact matches. Are both of these two things necessary or only one?

Stored Procedures

As all true achievers would know at this point stored procedures are bad m’kay? But what do all default SQL providers that come with ASP.NET use?

There’s a time and a place to use any tool. Grandma’s cooking recipe page (as adapted from the Personal Site Starter Kit) is not one of them.

CSS Friendly Adapters

OK, I’ll give you a moment to collect yourself from the belly laugh at seeing “CSS” in a Microsoft product.
Instead of pumping you full of menial rage, I’ll give you a small sample of the output generated by the “CSS Friendly” portion…

<div class="AspNet-DetailsView-Data">
  <ul>
    <li class="AspNet-DetailsView-Alternate">
      <span class="AspNet-DetailsView-Name">Title</span>
      <span class="AspNet-DetailsView-Value">
        <input name="ctl00$ContentMain$DetailsView1$ctl02" type="text" title="Title" />
      </span>
    </li>
    <li>
      <span class="AspNet-DetailsView-Name">Description</span>
      <span class="AspNet-DetailsView-Value">
        <input name="ctl00$ContentMain$DetailsView1$ctl03" type="text" title="Description" />
      </span>
    </li>
  </ul>
</div>

Notice any <label> or <fieldset> tags? Notice any class name shorter than 20 characters?
I didn’t think so. Goodbye accessibility, hello “CSS Bloat”… er… I mean “Friendly”.

Here’s the same code as rendered properly

<div class="DetailsView">
  <ul>
    <li class="Alt">
      <label>Title
        <input name="Title" type="text" title="Title" />
      </label>
    </li>
    <li>
      <label>Description
        <input name="Description" type="text" title="Description" />
      </label>
    </li>
  </ul>
</div>

I might as well have written a custom control from scratch.

Man, I miss Notepad so much!

…………………………

I’m thinking about creating a simple framework for web apps that don’t use any of this nonsense and releasing it into the Public Domain. If anything, it will at least help out some people who want to start fresh and free from the above plagues. Honestly, I don’t even care if anyone gives me credit. I just don’t need another heart attack from wading through all this garbage.

8 thoughts on “5 Useless things, used often in web apps

  1. hehehehehe

    Now I see! :)

    I give you credit! Go ahead. I’m a big and complex project using all of the Microsoft technologies and actually I’m very scared about the quality of the code generated by those “super-controls” rendering tables and outdated attributes… :S

    But your post regarding Web Parts certainly will be part of our resources!

    Best Regards!

  2. Hi,

    Just in reply to your comment regarding GUID. I realise that you and many many others are, as you say, quite content with 1 database and 1 server. When and if you develop a really successful web application and the requirement to grow your application over multiple servers, GUID does come in handy. It also comes in handy when you develop Business Objects, as you have the ObjectID without having to look to the database to generate a new one. Assuming you use the auto incrementing integer.

    Also with regards to your post about Stored Procedures being “Bad,” firstly I disagree ofcourse, and secondly using the new CLR Features in SQL, I can for example use C# to create a compiled Stored Procedure which yields even greater performance. Out of interest, what do you use as opposed to Stored Procedures? Are you working with LINQ?

    Cheers for the article,

    I enjoyed reading it.

    Andrew

  3. Hi Andrew.

    I have used GUID’s in production apps, but I can, literally, count on one hand the number of times where we had to farm it out.
    Most of the time it’s for a MS SQL app and often the app never leaves the single server. Sometimes the DB Server and Web server are one in the same.

    I had to develop an AI app once and that was the only time I used LINQ. It was for a neural net/P2P experiement. Dealing with objects alone was very appealing in this case. But I wouldn’t use it for web developement as that puts too much data logic in the business layer.

    The SQL CLR approach becomes impractical for me when dealing with hosted apps. It becomes even more frustrating when I don’t have any say over how the SQL server is managed. Often times the left hand doesn’t know what the right hand is doing in many places, and that’s really frustrating for developers. I wish it was only me (sometimes) that’s involved in a project, but that’s not always the case. Life would be a lot simpler if it was.

    And I also have reservations against putting too much logic into the data layer as I don’t always control how the code will be used.
    I’ve been told :
    “it’s MS SQL, it’s MS SQL, it’s MS SQL, it’s MS SQL, it’s MS SQL”
    Then, BAM! It’s something else. Aaarrrrrgh!!

    I find more and more project managers prefer PostgreSQL or Oracle. Postgre if they’re on a budget or need something custom super fast and Oracle if that’s what they’ve been using all along and are familiar with it.
    The GUID issue really does become a headache in these circumstances.

    If it was up to me, I would ditch all of them and go with an object database, but that’s only in my dreams.

    My true source of frustration, really, isn’t with Microsoft or these “Useless things” I make fun of.
    They do serve their purpose when used appropriately, but I just have to deal with them at times when they were used incredibly inappropriately either because of lazyness or ignorance.

    It’s just my way of venting without naming my employers, co-workers, and customers ;)

    Glad you enjoyed it!

  4. Love your blog. I really like that I am not the only one who thinks this way ;) The only thing I disagree with is GUIDs.

    The ONLY reason I say this is because I’ll take a head-ache of guids over a turrets inducing migraine called a database. I want to strangle myself for people who use surrogate keys.

    I hate databases, I just serialize the freaking object to XML and then write a stored procedure to take the entire XML dump and persist it.

    I usually (privately) dont use databases anyway, giant dinosaurs. Use a “fake” database like an in-memory object collection that persists itself to a flat XML file.

    Anyway… ranting… keep it up!

  5. Thanks Terrance!
    Will do :D

    Yeah, I hate databases too. Which is why I’ve been strongly thinking about dumping them altogether and doing some kind of object/XML persistence. Really, the things DBs are used for nowadays go way beyond what these systems were originally designed for.

    We’re already pushing the limits of their capability and in the process, as you’ve already seen, people abuse features to no end.

    That said, privately I’ve been experimenting with object persistence. I couldn’t do XML for a recent project because of file size issues and because I had to store binary blobs.

    But one thing for sure, RDBMS ain’t the silver bullet any more.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s