Blog  |   Puzzles  |   Books  |   About

Programmers are Lazy, Part 1

This blog is intended to be lighthearted and fun, and it is not normally my policy to fill it with angst and invective. But sometimes a guy has to rant. Today’s rant is directed at lazy programmers. We know who we are.

Computers are labor saving devices, so it is natural that the programming field attacts lazy people. The worst of these lazy programmers generally gets stuck programming boring things like shopping carts, which, sadly, the rest of us have to use.

Here is today’s example:

This is a screenshot from a poorly designed website I occasionally use when I’m worried a movie is going to sell out before I get to the theater (this has not been a problem the past 2 months, thanks Hollywood!).

If you’ve used credit cards online, you’ve probably seen similar forms with the same stupid design. I’m speaking of the prompt which requests that you not enter spaces or dashes along with your credit card number. This is a feature on nearly every credit card form I’ve used.

It is an example of incredible laziness. It actually takes one line. ONE LINE of javascript to remove spaces and dashes from a credit card number before sending it to the server. That line reads as follows:

n = n.replace(/\D/g,"");

That’s it. It also takes one line of code to accomplish this in PHP or Perl, should you wish to perform the feat on the server. But even if it took fifty lines, the minor pain that it would cause the programmer is a fair trade for the fifty thousand seconds of minor pain that the lazy programmer creates for the throngs who visit the website.

But ’cause some lazy programmer was too lazy to figure this out, we are stuck with an incredibly stupid interface. An interface which has become so ubiquitous that many other lazy programemrs simply copy the design, thinking this is the way things should be done.

Allowing users to enter spaces and hyphens with their credit card numbers is actually a good and noble thing. It makes the numbers more readable, especially for those of us who are far sighted. It makes the numbers more closely resemble the way they are arranged on your credit card, thus insuring accuracy, and enabling the user to do better error checking.

Finally, if you allow spaces and hyphens, you don’t have to clutter your interface with a message that asks users not to enter them — a message, incidentally, which is about as long, and sometimes longer, than the above line of code.

One Response to “Programmers are Lazy, Part 1”

  1. rgovostes Says:

    While programmers do need to be more relaxed with text formatting (the machines are the ones that are supposed to be formatting stuff, not us!), in the meantime you could use Greasemonkey, an extension for Firefox that lets you use JavaScript to tweak the source of a page.

    http://greasemonkey.mozdev.org/