Possible Duplicate:
Using “Foo” and “Bar” in examples

I discovered that in many examples of code i various books/questions/answers/tutorials the word Foo is used to name functions, interfaces, classes, properties, variables etc.

  • It is a special name, or is simple to name something in 3 letters, and why Foo?

3 Answers 3


Excerpted from the Jargon File:

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.

For, it seems, the word ‘foo’ itself had an immediate prewar history in comic strips and cartoons. The earliest documented uses were in the Smokey Stover comic strip published from about 1930 to about 1952. Bill Holman, the author of the strip, filled it with odd jokes and personal contrivances, including other nonsense phrases such as “Notary Sojac” and “1506 nix nix”. The word “foo” frequently appeared on license plates of cars, in nonsense sayings in the background of some frames (such as “He who foos last foos best” or “Many smoke but foo men chew”), and Holman had Smokey say “Where there's foo, there's fire”.

If this sort of etymological study is of interest to you, there's a vast wellspring more of it at the link.

But what's known for certain is that the modern usage of foo (and bar, and much other modern computer nonsense jargon) is first documented as appearing at MIT in the late 1950s. Which bits of jargon the MIT engineers/students picked up from elsewhere (say, from a popular comic strip from six or seven years earlier), and which they invented themselves is much less well-documented. Hints about a history pre-dating the MIT Tech Model Railroad Club are intriguing, but are also mostly supposition and anecdotes.


Pardon my french, but you asked.....

foo is the first part of foobar.

foobar = FUBAR = Fucked up beyond all recognition.

Yes. That's what it means. The foobar spelling is based on the sound based phonics. How did it become popular in programming examples??? That I don't know.


It's a component of 'FooBar', a commonly used placeholder name and metasyntatic variable.

From the Wikipedia Article:

The terms foobar /ˈfʊːbɑː/, fubar, or foo, bar, baz and qux (alternatively quux) are sometimes used as placeholder names (also referred to as metasyntactic variables) in computer programming or computer-related documentation. They have been used to name entities such as variables, functions, and commands whose purpose is unimportant and serve only to demonstrate a concept. The words themselves have no meaning in this usage. Foobar is sometimes used alone; foo, bar, and baz are sometimes used in that order, when multiple entities are needed.