Foo / Bar / Baz
/fuː bɑːr bæz/ · Noun · Hacker Culture · Origin: 1960
Definitions
The canonical metasyntactic variables used in programming examples, documentation, and teaching. When a programmer needs a throwaway name for a variable, function, or server, these are the sacred defaults. Likely derived from the WWII military slang 'FUBAR.'
In plain English: Meaningless placeholder names that programmers use in examples, like how math teachers use 'x' and 'y' — they don't mean anything, they're just stand-ins.
Other programming traditions have their own metasyntactic variables: Python uses spam, eggs, ham (from Monty Python); Japanese programmers use hoge, fuga, piyo; German programmers use bla, blub. The choice of placeholder names is a cultural fingerprint.
Example: 'function foo(bar) { return baz; } — if you see this in production code, someone copied it from documentation and forgot to rename the variables.'
Source: cultural variants
Etymology
- WWII
- Military slang FUBAR (F***ed Up Beyond All Recognition) enters the lexicon
- 1960s
- MIT programmers adopt 'foo' and 'bar' as placeholder names
- 1975
- Jargon File codifies foo, bar, baz as the canonical metasyntactic variables
Origin Story
From a model railroad club at MIT to every code example ever written
The placeholder variables **foo**, **bar**, and **baz** are the most widely used metasyntactic variables in programming. Their origin is debated, but the most credible trail leads to MIT's **Tech Model Railroad Club** (TMRC) in the late 1950s, where members used "foo" as a general purpose placeholder, likely derived from the WWII-era military slang **FUBAR** ("Fouled Up Beyond All Recognition," or a stronger variant).
The TMRC was the direct precursor of hacker culture. Many of its members went on to MIT's AI Lab and brought their vocabulary with them. By the time the Jargon File was compiled in 1975, `foo` and `bar` were already entrenched. `baz` came later as a natural extension when you needed a third variable.
RFC 3092 ("Etymology of 'Foo'"), published in 2001, traces the full history and concludes that the FUBAR connection is likely but unproven. What's certain is that `foo` and `bar` have appeared in millions of tutorials, documentation pages, and Stack Overflow answers, making them arguably the most-read variable names in human history.
Coined by: MIT Tech Model Railroad Club (likely)
Context: MIT TMRC, late 1950s
Fun fact: RFC 3092, the 'Etymology of Foo,' is a real, published RFC. It's one of several humorous or historical RFCs, alongside RFC 2324 (Hyper Text Coffee Pot Control Protocol) and RFC 1149 (IP over Avian Carriers — i.e., carrier pigeons).