The anti-foo, bar, baz and bat rant

If you’re not a computer nerd you can skip this post. I posted a Saturday news update earlier this morning.

When I was a teenager I got into computers. I’d scour the sale rack at bookstores, looking for any book I could find with programs in BASIC, the computer language I mostly used at the time. One day I picked up a major score: A computer book on sale for $1 that contained code for ELIZA, a program that could seemingly carry on a conversation with a human.

As I read through the book I noticed a couple of things. First of all, “foo” and “bar” were commonly used as variable names, and sometimes “baz” and “bat” as well. I thought that was kind of stupid, but whatever. I also noticed that the book talked about mainframes a lot, odd because I was living in the era of the personal computer. “Exactly how old is this book?” I wondered. I turned to the copyright page and discovered it was published in 1973, an era in which Nixon was president and tube tops were a new invention.

A year later I took my first programming class in college, using Pascal. The professor also used those foo, bar, baz, and bat variables. “What is the deal with those?” I thought.

A few years ago, I was trying out different PHP frameworks, just messing around on my MacBook. As I read through the documentation, there they were again. Foo, bar, baz and bat were alive and well in the 21st century.

And then last week, I had to put a carousel on a web page. If you don’t know what a carousel is, go to ESPN’s site and look at the scores at the top, where you can use arrows to scroll to a new set of scores. That’s a carousel. Being a big fan of OPC (other people’s code), I did a Google search and found one ready to plug in, right out of the box. The elements of the carousel – for example the individual game scores on ESPN’s site – were surrounded by a container, known as a DIV in nerd-speak. And what was the name of the DIV?

foo.

Folks, it is time for foo, bar, baz, and bat to be put out to pasture. Stop using them as variable names. Stop using them as web element names. Stop using them at all. Let’s make tombstones for foo, bar, baz, and bat and put “1973-2013” on them and move on.

BONUS RANT: If you use “SWEEB!” and “SUPER-sweeb!!!” in your software documentation, it makes me want to reach through the Internet and strangle you.