Jargon
February 13th, 2009
“Any questions before we start the exam?”
“Does the word ‘foo’ appear on it anywhere?”
It was a valid question. Prior to teaching, I never found myself using the commonly used terms “foo”, “bar”, and “baz”. I suppose if anything, I was more inclined to use “stuff” or “blah”. Yet for some reason I’d be standing at the white board last semester searching for some dummy word to use as a variable or method name in order to concretely convey a concept and I inevitably found my way back to the common three.
The pre-exam question wasn’t the first time someone called me out on it either. Last semester a student both noted that not only had I faithfully stuck with foo, but he had adopted the practice. So with last night’s comment, I figured a little googling was in order.
One definition I consistently came across is as follows:
When ‘foo’ is used in connection with ‘bar’ it has generally traced to the WWII-era Army slang acronym FUBAR (‘Fucked Up Beyond All Repair’ or ‘Fucked Up Beyond All Recognition’), later modified to foobar. Early versions of the Jargon File interpreted this change as a post-war bowdlerization, but it it now seems more likely that FUBAR was itself a derivative of ‘foo’ perhaps influenced by German furchtbar (terrible) — ‘foobar’ may actually have been the original form.
Ok, while that confirms my assumption that it somehow related to the idea of being completely fouled up — which has a definite applicability to programming — that doesn’t really say much to why foo. Not surprisingly, wikipedia had quite a bit to say:
It is likely that the use of foo in hacker and eventually in programming context originated in MIT’s Tech Model Railroad Club (TMRC). In the complex model system there were scram switches located at numerous places around the room that could be thrown if something undesirable was about to occur, such as a train going full-bore at an obstruction. Another feature of the system was a digital clock on the dispatch board. When someone hit a scram switch the clock stopped and the display was replaced with the word “FOO”; at TMRC the scram switches are therefore called “foo switches”. Because of this an entry in the 1959 Dictionary of the TMRC Language went something like this: “FOO: The first syllable of the sacred chant phrase “foo mane padme hum.” Our first obligation is to keep the foo counters turning.
That’s a pretty solid idea right there, though it lacks the “Oh, how cool” response I was hoping for. Perhaps that’s my fault for expecting some sort of grand creativity from a bunch of hackers. I did however find the following pretty interesting:
Foo or any such word used this way is formally known as a metasyntactic variable. Eric Raymond, probably the world’s greatest authority on foo and other metasyntactic variables, also lists qux, waldo, fred, xyzzy, and thud among others that are occasionally used. Although foo is the canonical metasyntactic variable, Raymond notes that cultures outside the United States have their own preferences. Fred, barney, and wombat seem common in the U.K. Toto, tata, titi, and tutu reportedly are used by the French. Blarg and wibble are used in New Zealand.
The use of a metasyntactic variable is helpful in freeing a programmer from creating a logically named variable, although the invented term may also become sufficiently popular and enter the language as a neologism. The word foo is the principal example.
If nothing else, this should give me a new pool of “metasyntactic variables” (i.e. random words) to use when I’m on the spot in front of a classroom.
Oh, and for the record, all three of “foo”, “bar”, and “baz” appeared on the exam.

