share
English Language & UsageWhat does "foo" mean?
[+24] [8] Tim
[2011-05-30 20:17:49]
[ meaning ]
[ https://english.stackexchange.com/questions/27843/what-does-foo-mean ]

I saw that "foo" has been used to name a lot of computer-related things.

I wonder

  1. if foo has some meaning itself beyond computer science?
  2. what it means in computer science?
  3. how it should be used?
(This question reminds me of a musical band called The Foo Fighters -- in an interview on CBC Radio a few years ago they told the interviewer that they "fight foo" in their spare time.) - Randolf Richardson
(12) Pity the Foo, who has to be in every programming example, but never gets to do any real work. ;) - Guffa
(2) Just fyi, Foo Fighters takes its name from the World War II-era term. en.wikipedia.org/wiki/Foo_fighter - Robert S.
(2) foo means absolutely nothing —which is precisely why it is used! - Mechanical snail
[+16] [2011-05-30 20:23:13] Matthew Read [ACCEPTED]

The Wikipedia entry for Foobar [1] covers this pretty thoroughly (emphasis mine):

The terms foobar, foo, bar, baz and qux 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.

[...]

The origins of the terms are not known with certainty, and several anecdotal theories have been advanced to identify them. Foobar may have derived from the military acronym FUBAR [2] and gained popularity because it is pronounced the same. In this meaning it also can derive from the German word furchtbar, which means awful and terrible and described the circumstances of the Second World War.

FOO is an abbreviation of Forward Observation Officer, a British Army term in use as early as the First World War. The etymology of foo is explored in the Internet Engineering Task Force (IETF) Request for Comments 3092, which notes usage of foo in 1930s cartoons including The Daffy Doc (with Daffy Duck) and comic strips, especially Smokey Stover and Pogo. From there the term migrated into military slang, where it merged with FUBAR. "Bar" as the second term in the series may have developed in electronics, where a digital signal which is considered "on" with a negative or zero-voltage condition is identified with a horizontal bar over the signal label; the notation for an inverted signal foo would then be pronounced "foo bar". Bar may also be read as beyond all repair, which is how it is used in the acronym FUBAR.

The use of foo in hacker and eventually in programming context may have begun 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 misquoted sacred chant phrase 'foo mane padme hum.' Our first obligation is to keep the foo counters turning."

One book describing the MIT train room describes two buttons by the door: labelled foo and bar. These were general purpose buttons and were often re-purposed for whatever fun idea the MIT hackers had at the time. Hence the adoption of foo and bar as general purpose variable names.

[1] http://en.wikipedia.org/wiki/Foobar
[2] http://en.wikipedia.org/wiki/FUBAR

Interesting - the 'bar' part had never occurred to me, although we did try and get lines named 'free' into circuits so we could have 'free bar' - mgb
(1) Here's another interesting link: if you are going to be working with computers more the Jargon File is informative and very fun to read. - JeffSahol
@JeffSahol - Better IMHO (although heavily Brit-influenced) is the Free Online Dictionary of Computing (aka FOLDOC). foldoc.org - T.E.D.
1
[+12] [2011-07-16 19:37:25] Hugo

First, some short specific answers, and then let's take a longer etymological ramble of how it likely entered computer science.

  1. if foo has some meaning itself beyond computer science?

Beyond computer science, foo was a nonsense word that was used in comics and American popular culture of the early 20th century.

  1. what it means in computer science?

In computer science, foo is a metasyntactic variable, a placeholder or alias for whatever is under discussion. Commonly used alongside bar.

  1. how it should be used?

It should be used in example code and when discussing code, such as this:

my ($foo, $bar) = @{shift(@_)}{qw/ -foo -bar /};


Are you sitting comfortably? Then I'll begin.

tl;dr [1]

  • "Foo" and "bar" as metasyntactic variables were popularised by MIT and DEC, the first references are in work on LISP and PDP-1 and Project MAC from 1964 onwards.

  • Many of these people were in MIT's Tech Model Railroad Club, where we find the first documented use of "foo" in tech circles in 1959 (and a variant in 1958).

  • Both "foo" and "bar" (and even "baz") were well known in popular culture, especially from Smokey Stover and Pogo comics, which will have been read by many TMRC members.

  • Also, it seems likely the military FUBAR contributed to their popularity.


The use of lone "foo" as a nonsense word is pretty well documented in popular culture in the early 20th century, as is the military FUBAR. (Some background reading: FOLDOC [2] FOLDOC [3] Jargon File [4] Jargon File [5] Wikipedia [6] RFC3092 [7])


OK, so let's find some references.

STOP PRESS! After posting this answer, I discovered this perfect article about "foo" in the Friday 14th January 1938 edition of The Tech [8] ("MIT's oldest and largest newspaper & the first newspaper published on the web"), Volume LVII. No. 57, Price Three Cents:

On Foo-ism

The Lounger thinks that this business of Foo-ism has been carried too far by its misguided proponents, and does hereby and forthwith take his stand against its abuse. It may be that there's no foo like an old foo, and we're it, but anyway, a foo and his money are some party. (Voice from the bleachers- "Don't be foo-lish!")

As an expletive, of course, "foo!" has a definite and probably irreplaceable position in our language, although we fear that the excessive use to which it is currently subjected may well result in its falling into an early (and, alas, a dark) oblivion. We say alas because proper use of the word may result in such happy incidents as the following.

It was an 8.50 Thermodynamics lecture by Professor Slater in Room 6-120. The professor, having covered the front side of the blackboard, set the handle that operates the lift mechanism, turning meanwhile to the class to continue his discussion. The front board slowly, majestically, lifted itself, revealing the board behind it, and on that board, writ large, the symbols that spelled "FOO"!

The Tech newspaper [9], a year earlier, the Letter to the Editor, September 1937:

By the time the train has reached the station the neophytes are so filled with the stories of the glory of Phi Omicron Omicron, usually referred to as Foo, that they are easy prey.

...

It is not that I mind having lost my first four sons to the Grand and Universal Brotherhood of Phi Omicron Omicron, but I do wish that my fifth son, my baby, should at least be warned in advance.

Hopefully yours,

Indignant Mother of Five.

And The Tech [10] in December 1938:

General trend of thought might be best interpreted from the remarks made at the end of the ballots. One vote said, '"I don't think what I do is any of Pulver's business," while another merely added a curt "Foo."


The first documented "foo" in tech circles is probably 1959's Dictionary of the TMRC Language [11]:

FOO: the sacred syllable (FOO MANI PADME HUM); to be spoken only when under inspiration to commune with the Deity. Our first obligation is to keep the Foo Counters turning.

These are explained at FOLDOC [12]. The dictionary's compiler Pete Samson said in 2005:

Use of this word at TMRC antedates my coming there. A foo counter could simply have randomly flashing lights, or could be a real counter with an obscure input.

And from 1996's Jargon File 4.0.0 [13]:

Earlier versions of this lexicon derived 'baz' as a Stanford corruption of bar. However, Pete Samson (compiler of the TMRC lexicon) reports it was already current when he joined TMRC in 1958. He says "It came from "Pogo". Albert the Alligator, when vexed or outraged, would shout 'Bazz Fazz!' or 'Rowrbazzle!' The club layout was said to model the (mythical) New England counties of Rowrfolk and Bassex (Rowrbazzle mingled with (Norfolk/Suffolk/Middlesex/Essex)."

A year before the TMRC dictionary, 1958's MIT Voo Doo Gazette ("Humor suplement of the MIT Deans' office") (PDF) [14] mentions Foocom, in "The Laws of Murphy and Finagle" by John Banzhaf (an electrical engineering student):

Further research under a joint Foocom and Anarcom grant expanded the law to be all embracing and universally applicable: If anything can go wrong, it will!

Also 1964's MIT Voo Doo (PDF) [15] references the TMRC usage:

Yes! I want to be an instant success and snow customers. Send me a degree in: ...

  • Foo Counters

  • Foo Jung


Let's find "foo", "bar" and "foobar" published in code examples.

So, Jargon File 4.4.7 [16] says of "foobar":

Probably originally propagated through DECsystem manuals by Digital Equipment Corporation (DEC) in 1960s and early 1970s; confirmed sightings there go back to 1972.

The first published reference I can find is from February 1964, but written in June 1963, The Programming Language LISP: its Operation and Applications [17] by Information International, Inc., with many authors, but including Timothy P. Hart and Michael Levin:

Thus, since "FOO" is a name for itself, "COMITRIN" will treat both "FOO" and "(FOO)" in exactly the same way.

Also includes other metasyntactic variables such as: FOO CROCK GLITCH / POOT TOOR / ON YOU / SNAP CRACKLE POP / X Y Z

I expect this is much the same as this next reference of "foo" from MIT's Project MAC in January 1964's AIM-064, or LISP Exercises [18] by Timothy P. Hart and Michael Levin:

car[((FOO . CROCK) . GLITCH)]

It shares many other metasyntactic variables like: CHI / BOSTON NEW YORK / SPINACH BUTTER STEAK / FOO CROCK GLITCH / POOT TOOP / TOOT TOOT / ISTHISATRIVIALEXCERCISE / PLOOP FLOT TOP / SNAP CRACKLE POP / ONE TWO THREE / PLANE SUB THRESHER

For both "foo" and "bar" together, the earliest reference I could find is from MIT's Project MAC in June 1966's AIM-098, or PDP-6 LISP [19] by none other than Peter Samson:

EXPLODE, like PRIN1, inserts slashes, so (EXPLODE (QUOTE FOO/ BAR)) PRIN1's as (F O O // / B A R) or PRINC's as (F O O / B A R).


Some more recollections.

@Walter Mitty [20] recalled on this site in 2008:

I second the jargon file regarding Foo Bar. I can trace it back at least to 1963, and PDP-1 serial number 2, which was on the second floor of Building 26 at MIT. Foo and Foo Bar were used there, and after 1964 at the PDP-6 room at project MAC.

John V. Everett [21] recalls in 1996:

When I joined DEC in 1966, foobar was already being commonly used as a throw-away file name. I believe fubar became foobar because the PDP-6 supported six character names, although I always assumed the term migrated to DEC from MIT. There were many MIT types at DEC in those days, some of whom had worked with the 7090/7094 CTSS. Since the 709x was also a 36 bit machine, foobar may have been used as a common file name there.

Foo and bar were also commonly used as file extensions. Since the text editors of the day operated on an input file and produced an output file, it was common to edit from a .foo file to a .bar file, and back again.

It was also common to use foo to fill a buffer when editing with TECO. The text string to exactly fill one disk block was IFOO$HXA127GA$$. Almost all of the PDP-6/10 programmers I worked with used this same command string.

Daniel P. B. Smith [22] in 1998:

Dick Gruen had a device in his dorm room, the usual assemblage of B-battery, resistors, capacitors, and NE-2 neon tubes, which he called a "foo counter." This would have been circa 1964 or so.

Robert Schuldenfrei [23] in 1996:

The use of FOO and BAR as example variable names goes back at least to 1964 and the IBM 7070. This too may be older, but that is where I first saw it. This was in Assembler. What would be the FORTRAN integer equivalent? IFOO and IBAR?

Paul M. Wexelblat [24] in 1992:

The earliest PDP-1 Assembler used two characters for symbols (18 bit machine) programmers always left a few words as patch space to fix problems. (Jump to patch space, do new code, jump back) That space conventionally was named FU: which stood for Fxxx Up, the place where you fixed Fxxx Ups. When spoken, it was known as FU space. Later Assemblers ( e.g. MIDAS allowed three char tags so FU became FOO, and as ALL PDP-1 programmers will tell you that was FOO space.

Bruce B. Reynolds [25] in 1996:

On the IBM side of FOO(FU)BAR is the use of the BAR side as Base Address Register; in the middle 1970's CICS programmers had to worry out the various xxxBARs...I think one of those was FRACTBAR...

Here's a straight IBM "BAR" [26] from 1955.


Other early references:


I haven't been able to find any references to foo bar as "inverted foo signal" as suggested in RFC3092 and elsewhere.

Here are a some of even earlier F00s but I think they're coincidences/false positives:


(From my answer to a couple of similar [45] questions [46] over on Programmers.SE)

[1] http://www.urbandictionary.com/define.php?term=tl%3Bdr
[2] http://foldoc.org/metasyntactic+variables
[3] http://foldoc.org/foo
[4] http://www.catb.org/jargon/html/F/foo.html
[5] http://www.catb.org/jargon/html/M/metasyntactic-variable.html
[6] http://en.wikipedia.org/wiki/Foobar
[7] http://www.faqs.org/rfcs/rfc3092.html
[8] http://tech.mit.edu/V57/PDF/N57.pdf
[9] http://tech.mit.edu/V57/PDF/N30.pdf
[10] http://tech.mit.edu/V58/PDF/N48.pdf
[11] http://www.gricer.com/tmrc/dictionary1959.html
[12] http://foldoc.org/TMRC
[13] http://www.jargon.net/jargonfile/b/baz.html
[14] http://web.mit.edu/voodoo/www/archive/pdfs/1958-Jun.pdf
[15] http://web.mit.edu/voodoo/www/archive/pdfs/1964-Jan.pdf
[16] http://www.catb.org/jargon/html/F/foobar.html
[17] http://books.google.com/books?ei=ynbhTd2PK8nUsgbQurSABg&ct=result&id=eH0sAQAAIAAJ&dq=%22project%20mac%22%20%2bfoo&q=foo#search_anchor
[18] http://dspace.mit.edu/handle/1721.1/5924
[19] http://dspace.mit.edu/handle/1721.1/5899
[20] https://softwareengineering.stackexchange.com/questions/69788/using-foo-and-bar-in-examples/69803#69803
[21] http://groups.google.com/group/alt.folklore.computers/browse_thread/thread/f2dcd4247b866a62/fc54f0f7d7329fb5
[22] http://groups.google.com/group/alt.folklore.computers/browse_thread/thread/6d8f44f725ef0e5d/0a6112662a880ddd
[23] http://groups.google.com/group/alt.folklore.computers/browse_thread/thread/f2dcd4247b866a62/fc54f0f7d7329fb5
[24] http://groups.google.com/group/alt.folklore.computers/browse_thread/thread/39c4d97bdd57a5ee/8db07ccaf99fc014
[25] http://groups.google.com/group/alt.folklore.computers/browse_thread/thread/f2dcd4247b866a62/fc54f0f7d7329fb5
[26] http://books.google.com/books?ei=bWfhTYeeNs7Osga10ciLBg&ct=result&id=mgUuAAAAIAAJ&dq=%22Base%20Address%20Register%22%20bar&q=bar#search_anchor
[27] http://dspace.mit.edu/handle/1721.1/5868
[28] http://hdl.handle.net/1721.1/6136
[29] http://books.google.com/books?ei=8WzhTfOPBo3ysgbBnvjsBQ&ct=result&id=aOQRAQAAMAAJ&dq=f00%20pdp&q=foo#search_anchor
[30] http://books.google.com/books?ei=ZSzhTaPbGYuVswaMoPT9BQ&ct=result&id=80UsAQAAIAAJ&dq=foo%20baz&q=baz#search_anchor
[31] https://www.rfc-editor.org/rfc/rfc269
[32] http://dspace.mit.edu/handle/1721.1/41939
[33] http://www.inwap.com/pdp10/hbaker/hakmem/hacks.html
[34] http://dspace.mit.edu/bitstream/handle/1721.1/6086/AIM-239.pdf?sequence=2
[35] http://books.google.com/books?ei=PSHhTdjDO8rLswbXr5WDBg&ct=result&id=jZdPAAAAYAAJ&dq=foo%20%20%22Digital%20Equipment%20Corporation%22&q=foo#search_anchor
[36] http://books.google.com/books?ei=viLhTbe8Cs_3sgaC48SPBg&ct=result&id=VfQRAQAAMAAJ&dq=%2bfoo%20%20%22Digital%20Equipment%20Corporation%22&q=foo#search_anchor
[37] http://books.google.com/books?id=glNQAAAAMAAJ&q=foo%20bar&dq=foo%20bar&hl=en&ei=7NTfTdnmNM2WOpKL7YIK&sa=X&oi=book_result&ct=result&resnum=2&sqi=2&ved=0CDAQ6AEwAQ
[38] http://books.google.com/books?id=qVRQAAAAMAAJ&q=%22foo%20bar%22&dq=%22foo%20bar%22&hl=en&ei=CdTfTe69LcqUOuSQ8fcJ&sa=X&oi=book_result&ct=result&resnum=1&ved=0CCwQ6AEwAA
[39] http://books.google.com/books?ei=19XfTcSeBMKBOvWTuegJ&ct=result&id=NpsZAQAAIAAJ&dq=%2bfoobar&q=foobar#search_anchor
[40] http://books.google.com/books?id=zqomAAAAMAAJ&q=foobar&dq=foobar&hl=en&ei=EdbfTYWNIJCSOozL6Y4K&sa=X&oi=book_result&ct=result&resnum=1&ved=0CDAQ6AEwAA
[41] http://www.panda.com/tops-20/software-wars.html
[42] http://books.google.com/books?ei=W2rhTf_oIZCTswbVv8z7BQ&ct=result&id=mOkuAAAAIAAJ&dq=ibm%20foo&q=foo#search_anchor
[43] http://books.google.com/books?ei=WyXhTfP9AYePswbtl6GQBg&ct=result&id=uo_QAAAAMAAJ&dq=%2bfoo%20signal%20-fog&q=foo#search_anchor
[44] http://books.google.com/books?ei=8iHhTY6SPMvJswbD1eWFBg&ct=result&id=aGVXAAAAMAAJ&dq=%2bfoo%20%20%22Digital%20Equipment%20Corporation%22&q=%20foo#search_anchor
[45] https://softwareengineering.stackexchange.com/questions/221/whats-the-origin-of-foo-and-bar/80624#80624
[46] https://softwareengineering.stackexchange.com/questions/69788/using-foo-and-bar-in-examples/80609#80609

2
[+7] [2011-05-30 20:23:19] Frantisek

Foo is a metasyntactic variable used to represent an unspecified entity. If part of a series of such entities, it is often the first in the series, and followed immediately by bar, for example: "Suppose we have two objects, foo and bar."

It's a singular noun (which also has a plural: foos) and the usage reflects this fact.


3
[+3] [2011-05-30 20:38:35] Grant Thomas

You may also notice this extends to use of bar, too; interestingly or not, combining the two to construct foobar gives us a word resembling the acronym FUBAR [1], whether or not this is the phrase that gave rise to use, I surely don't know, but to answer your questions directly:

  • no, foo has no meaning in itself
  • it is a placeholder name for variable and method names and such-and-so
  • it really shouldn't be used at all these days - years have been spent encouraging people to write meaningful code, for it should be nigh self-explanatory as possible; I would even discourage it in samples in places such as StackOverflow - this also extends beyond code, for example, in building folder structures and whatnot
[1] http://en.wikipedia.org/wiki/FUBAR

(7) Disappointment - it's only ever used when giving an example without having to confuse the issue with the detail of the implementation. It's clearer to say an "object foo" than to say a "customer service record" if the example can also be generalised to other uses. Like the math use of a "number N" - mgb
@Martin Beckett: Being fully aware of the many scenarios in which it could be used, I can still confidently say that it should not be used at whim - it will no doubt find use, but such ought to be exception to the rule, not the rule. - Grant Thomas
Foo might not have a meaning in itself, but it was used outside computer science, indeed before computer science, as a nonsense word in the early 20th century. See english.stackexchange.com/questions/27843/what-does-foo-mean‌​/… - Hugo
4
[+2] [2011-05-30 21:25:29] Thursagen

Here it is defined [1] and some of its history noted, as well as examples of usage:

foo definition jargon /foo/ A sample name for absolutely anything, especially programs and files (especially scratch files).
First on the standard list of metasyntactic variables used in syntax examples. See also bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud.
The etymology of "foo" is obscure. When used in connection with "bar" it is generally traced to the WWII-era Army slang acronym FUBAR, later bowdlerised to foobar.
However, the use of the word "foo" itself has more complicated antecedents, including a long history in comic strips and cartoons.
"FOO" often appeared in the "Smokey Stover" comic strip by Bill Holman. This surrealist strip about a fireman appeared in various American comics including "Everybody's" between about 1930 and 1952. FOO was often included on licence plates of cars and in nonsense sayings in the background of some frames such as "He who foos last foos best" or "Many smoke but foo men chew".
Allegedly, "FOO" and "BAR" also occurred in Walt Kelly's "Pogo" strips. In the 1938 cartoon "The Daffy Doc", a very early version of Daffy Duck holds up a sign saying "SILENCE IS FOO!". Oddly, this seems to refer to some approving or positive affirmative use of foo. It has been suggested that this might be related to the Chinese word "fu" (sometimes transliterated "foo"), which can mean "happiness" when spoken with the proper tone (the lion-dog guardians flanking the steps of many Chinese restaurants are properly called "fu dogs").
Earlier versions of this entry suggested the possibility that hacker usage actually sprang from "FOO, Lampoons and Parody", the title of a comic book first issued in September 1958, a joint project of Charles and Robert Crumb. Though Robert Crumb (then in his mid-teens) later became one of the most important and influential artists in underground comics, this venture was hardly a success; indeed, the brothers later burned most of the existing copies in disgust. The title FOO was featured in large letters on the front cover. However, very few copies of this comic actually circulated, and students of Crumb's "oeuvre" have established that this title was a reference to the earlier Smokey Stover comics.
An old-time member reports that in the 1959 "Dictionary of the TMRC Language", compiled at TMRC there was an entry that 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.
For more about the legendary foo counters, see TMRC. Almost the entire staff of what became the MIT AI LAB was involved with TMRC, and probably picked the word up there.
Another correspondant cites the nautical construction "foo-foo" (or "poo-poo"), used to refer to something effeminate or some technical thing whose name has been forgotten, e.g. "foo-foo box", "foo-foo valve". This was common on ships by the early nineteenth century. Very probably, hackish "foo" had no single origin and derives through all these channels from Yiddish "feh" and/or English "fooey".
[ Jargon File] (1998-04-16)

[1] http://foldoc.org/foo

5
[0] [2011-05-31 04:46:35] DivinusVox

I've not been able to find a specific web reference (in my whole 4 minutes of poking around since reading this), but during a Computer Organization class, the professor (an old US Airforce engineer) claimed the individual word FOO was an old acronym for "Flicker On/Off" or a blip on the radar.

It was commonly used to identify objects that were otherwise unidentifiable via radar as well, making it an early pre-cursor to the term UFO.


Although I don't think this is related to the metasyntactic variable foo (see my long answer), this is still interesting and I hadn't heard it before. Did you know that foo fighter was used by WWII pilots to describe UFOs? This foo may have similar roots to the computing foo, or perhaps the French feu (fire) or faux (false). en.wikipedia.org/wiki/Foo_fighter - Hugo
6
[-3] [2014-11-20 15:36:56] James Flowers

Well, Foo is indeed used as a placeholder for an as yet unidentified/named object. It came from Foo Fighters and not Fubar. But as people were not as familiar with Foo Fighters and the term Fubar came to wide recognition through the movie Lethal Weapon, meaning has been conflated. So now we see Foo and Bar together, but they came from different places.


(1) Welcome to EL&U. You have not presented any evidence or references that Foo is derived from Foo Fighters, nor that Lethal Weapon is what popularized the term (it was released in 1987, but the spike in Google Books does not begin until 1990). I encourage you to visit the help center for additional guidance on crafting good answers. - choster
7
[-4] [2011-07-16 19:13:04] GEdgar

For "meaning itself" it can be an alternate spelling of "fu". For example, as in Google-fu [1], mastery of the use of Google.

[1] http://www.urbandictionary.com/define.php?term=google-fu

Do you have any references or examples? - Daniel
8