Keeping Up with the Kludges

There’s a very useful word in the techie sphere of influence that remains largely unknown in the wider world. It’s called kludge. According to Wikipedia, a kludge is “a clumsy or inelegant solution to a problem or difficulty.”

Kludges usually come about in programming when you either don’t have the time or the budget to deal with a certain problem. A basic example: you build a website that works just fine in all the modern versions of Mozilla Firefox, Internet Explorer, Opera, Flock, Safari, Netscape, Konqueror, etc. And then you get a call from an account rep in a different department asking in a strident tone of voice why the website is causing sparks to fly out of his client’s ancient WebTV box.

Jesus Christ, WebmasterIf Jesus Christ were your webmaster, he would clap his hands and come up with an elegant and elaborate piece of code that accounts for every browser on the market. This piece of programming legerdemain would not only deal with every WebTV and Mosaic 1.0 and Lynx browser still out there, but it would do so in a systematic way that would ensure compatibility with future unknown browsers and web services too. But you’re not Jesus Christ. Not only that, but you’ve got a million other pressing issues on your plate that are much more important than this.

On the other hand, this particular WebTV user happens to be the sister of the uncle of the CEO, and it’s worth spending ten or fifteen minutes to keep the CEO happy. So you grumble a little bit, fire up your text editor, and insert code that looks something like this:

<For all normal users...>
<Do this.>
<If the user is on a WebTV browser AND it's a Tuesday AND there's a full moon...>
<Do that.>
<Unless it's a Thursday and "Heroes" is still winning its timeslot, in which case...>
<Do something else entirely.>
<Now back to the normal code.>

Voila! You’ve created a kludge. It’s of no use to 99.9% of the world and it will slow down your application for everyone by some small fraction of a second — but on the other hand, it’s only taken you two minutes to write and the client’s happy.

Here’s a dirty little secret that the programmers don’t always tell you: all computer programs are full of kludges. Nobody ever intends to use them. Everyone’s application starts with the best of intentions and the cleanest of architectures. This is going to be the slickest widget ever! People will still be using it every day in 2035! Then life and the marketplace intervene, and the application wanders off track. You start to add kludges.

If Microsoft let you dig in to the source code for their operating systems, you’d see bazillions of kludges. Microsoft in particular is notorious for preserving backwards compatibility at all costs. Which means that in 20 years, when the only person left in the world using Lotus 1-2-3 is an old man with Alzheimer’s in Patagonia, the Windows Vista 20-Year Anniversary Edition (Now with Sherlock!) will still be able to run it.

But it’s not just computer programs that are full of kludges. Our lawbooks are full of kludges. I see from a page called Looney Laws that, in Michigan, a woman’s hair legally belongs to her husband; in Newport, Rhode Island, it’s illegal to smoke a pipe after sunset; and in Logan County, Colorado, it’s illegal for a man to kiss a woman while asleep. (Whether the same holds true if a woman kisses a sleeping man, the page does not say. In fact, it would be nice if the page would cite some references somewhere, but I won’t hold my breath.)

Read more

The Joy of Strict XHTML

I’ve recently discovered something else the Mozilla Firefox browser can do that Microsoft’s Internet Explorer can’t: Firefox can accept documents using the “application/xhtml+xml” header.

Who gives a shit? you might be thinking to yourself. Wait, I’ll explain. This might actually change your life someday.

For years, people have been writing web pages using the dated and somewhat arbitrary HTML 4 specification. If you don’t know what HTML looks like, take a look at the source code on any web page (by going to the “View” menu and selecting “Page Source” in Firefox or “View Source” in IE).

The problem is that during the web browser wars of the ’90s, Microsoft and Netscape both decided that they wanted their browsers to be as inclusive as possible. You could be a sloppy or an amateur coder, make all kinds of errors in your HTML, and the browser would silently compensate for you. For instance, the proper way to create a bulleted list is by using this code:

<ul>
<li>apples</li>
<li>oranges</li>
<li>bananas</li>
</ul>

But you could just as easily get away with typing this instead:

<UL>
<Li>apples
<li>oranges<lI>
<li>bananas
</ul></Ul>

Read more