DEV Community

pickuma
pickuma

Posted on • Originally published at pickuma.com

Where 'Foo' and 'Bar' Came From: A History of Placeholder Names

Open almost any programming tutorial and you will eventually meet foo and bar. They show up in function signatures, variable names, and example URLs, and nobody ever explains them. They are the dev world's equivalent of "lorem ipsum" — names chosen precisely because they carry no meaning.

What a Metasyntactic Variable Actually Is

The technical term for foo and bar is a metasyntactic variable: a placeholder name used in examples when the specific name does not matter. The point is to signal "this could be anything" without distracting the reader with a name that looks meaningful.

def process(foo, bar):
    return foo + bar
Enter fullscreen mode Exit fullscreen mode

If that example used total and tax_rate, you would start reasoning about taxes. With foo and bar, your attention stays on the structure — the function takes two arguments and adds them. That deliberate emptiness is the whole job. When you need a third or fourth, the conventional next names are baz and then qux.

Different communities have their own placeholder dialects. Python documentation famously uses spam and eggs, a nod to the Monty Python sketch that also gave the language its name. Cryptography papers almost universally use Alice and Bob as the two parties exchanging messages, with Eve as the eavesdropper. Designers reach for lorem ipsum, scrambled pseudo-Latin, when they need filler text. Each tradition solves the same problem: a name that holds a slot without hijacking attention.

The Murky Origins of Foo and Bar

Here is where honesty matters more than a tidy story. The exact origin of foo is genuinely contested, and anyone who tells you they know for certain is overselling it.

What is reasonably well documented is that foo existed as a nonsense word well before computers. It appeared in early-20th-century comics and cartoons — the Smokey Stover comic strip from the 1930s sprinkled "foo" everywhere as gag text — so the word was already floating around American pop culture as cheerful nonsense.

The leading theory for foobar specifically connects it to the WWII-era military slang FUBAR, an acronym whose polite expansion is "Fouled Up Beyond All Recognition." The idea is that engineers familiar with the term started writing "foobar" in examples, and it naturally split into the pair foo and bar. This is plausible and widely repeated, but the causal direction — did FUBAR create foobar, or did an existing "foo" just collide with the acronym? — is not settled.

What is clearer is where the pairing took hold: mid-20th-century engineering and hacker culture, especially around MIT. The terms appear in railroad-club and early computing slang from the 1950s and 60s, and they were carried forward by generations of programmers writing manuals, mailing lists, and textbooks. Repetition, not invention, is what made them universal.

People often assume foo and bar were always a clean two-name pair. In a lot of early usage, "foobar" appears as a single throwaway word — the split into separate foo and bar placeholders is partly a later convenience, helpful precisely because examples frequently need two distinct names. So the "FUBAR explains foo and bar" story is a bit too neat; it more plausibly explains "foobar."

Why the Convention Survives

The reason these names persist is not nostalgia — it is that meaningless placeholders are genuinely useful. A good example name should be recognizably fake so no reader mistakes it for something domain-specific. foo and bar are instantly recognized by experienced developers as "ignore the name, watch the mechanics," which is a small but real act of communication.

There is even a semi-official write-up: the Internet Engineering Task Force published an April Fools' RFC titled "The Etymology of 'Foo'" (RFC 3092) that catalogs the term's uses and theories. As an April 1st RFC it is half tongue-in-cheek, but it does collect the real folklore in one place — a sign of how seriously the community takes its own in-jokes.

So the next time you type foo, you are participating in a tradition that runs from 1930s comic strips through wartime slang and MIT terminals into your editor. It means nothing, deliberately, and that is exactly why it has lasted.

FAQ

A few common questions about placeholder names and how to use them.


Originally published at pickuma.com. Subscribe to the RSS or follow @pickuma.bsky.social for new reviews.

Top comments (0)