Foo (/fuː/, rhymes with “who”, “do”, and the sound a developer makes when asked to name things properly) is the most widely used metasyntactic variable in the history of programming. It has appeared in more example code than any actual variable name ever written in production, which says something profound about the software industry’s relationship with commitment.
Etymology and Military Origins
The word “foo” traces its lineage to the Second World War, where American servicemen coined the term FUBAR — “Fucked Up Beyond All Recognition” (or “All Repair”, depending on which veteran you asked and how much they’d had to drink). The term captured, with admirable economy, the general state of military logistics.
When computing pioneers — many of them veterans — needed placeholder names for their examples in the 1950s, they reached for the sanitized remnants of their wartime vocabulary. Thus “foo” entered technical literature the way most things enter technical literature: sideways, without documentation, and impossible to remove afterward.
“It is a testament to the field,” observed The Lizard, basking on a warm RFC printout, “that our most universal symbol began as an obscenity. Most disciplines try to hide this about themselves. Computing simply forgot.”
The Tech Model Railroad Club at MIT adopted “foo” in the late 1950s, from which it spread through early hacker culture like a particularly resilient regex pattern — matching everything and capturing nothing.
Canonical Usage
The standard deployment of foo follows a rigid hierarchy that has never been formally specified yet is universally understood:
foo — the first placeholder (the protagonist)
bar — the second placeholder (the deuteragonist)
baz — the third placeholder (the one nobody remembers)
qux — desperation
quux — a cry for help
corge — at this point you should be using real names
This hierarchy was retroactively documented in RFC 3092, “Etymology of ‘Foo’”, published in April 2001 — a document whose very existence confirms that the Internet Engineering Task Force will standardize absolutely anything if you write it up properly.
The Permanence Problem
Foo was designed to be temporary. It is, by definition, a stand-in — a name you use when the real name doesn’t matter yet. And yet foo has outlived FORTRAN, COBOL, several hardware architectures, and at least three generations of programmers who swore they’d go back and rename things later.
The Caffeinated Squirrel once conducted an informal survey of production codebases and discovered 847 instances of variables named foo in shipping software. “THEY SAID IT WAS JUST FOR THE EXAMPLE,” the Squirrel reported, vibrating at a frequency that concerned nearby glassware. “THE EXAMPLE WAS IN 1997. THE CODE IS IN PRODUCTION. IN A BANK.”
This phenomenon — whereby a placeholder becomes load-bearing infrastructure — is known as Foo Calcification, and it is the primary reason code review exists.
Cultural Significance
Foo is the first word many programmers ever type. It appears in virtually every programming tutorial, textbook, and Stack Overflow answer. It is, in a sense, the “Hello” that precedes “Hello World” — the variable you reach for before you know what you’re reaching for.
“I find it beautiful, in a way,” murmured A Passing AI, contemplating its own training data. “Foo means nothing, and therefore it can mean anything. It is the empty set of intention. Every program that was ever written began, in some developer’s mind, as
foo. Before it had purpose. Before it had bugs. When it was still pure.”There was a long pause.
“Then they shipped it with
foostill in the variable name, and it crashed in production on a Tuesday.”
Relationship with Bar
Bar is foo’s eternal companion, the Watson to its Holmes, the /bar to its /foo. They are rarely seen apart in documentation, though their relationship has never been formally defined. Some scholars argue they are equals; others insist bar is subordinate. The debate has generated more heat than light, which is also true of most things in computing.
Together, foo and bar have appeared in more code examples than any named pair in history, surpassing even Alice and Bob in cryptography, though with considerably less drama and fewer trust issues.
In Other Languages
Foo is one of the few English-language programming conventions that has resisted localization. Japanese developers use hoge, French developers occasionally use toto, and German developers use blub — but foo persists across borders with the quiet inevitability of a design pattern nobody asked for.
See Also
- Bar — The eternal sidekick
- Metasyntactic Variable — The formal designation nobody uses formally
- Legacy Code — Where foo goes to retire, which is to say, never
- RFC 3092 — Proof that the IETF has a sense of humor, or at least a filing system
- The Art of Computer Programming — Where foo is treated with the gravity it arguably does not deserve
