Revision as of 10:45, 24 November 2012 editRobot Monk (talk | contribs)448 editsm fix interwiki conflicts← Previous edit | Revision as of 00:28, 5 December 2012 edit undoAwjrichards (talk | contribs)73 edits revert! test mobile edit. Tag: Mobile editNext edit → | ||
Line 2: | Line 2: | ||
{{Other uses}} | {{Other uses}} | ||
{{Redirect|Foo|FOO (Forward Observation Officer)|Artillery observer}} | {{Redirect|Foo|FOO (Forward Observation Officer)|Artillery observer}} | ||
bananas | |||
The terms '''foobar''' ], fubar, or '''foo''', '''bar''', '''baz''' and '''qux''' (alternatively '''quux''') are sometimes used as ]s (also referred to as ]s) in ] or computer-related documentation.<ref name="rfc3092" /> They have been used to name entities such as ]s, ], and ]s 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 terms '''foobar''' ], fubar, or '''foo''', '''bar''', '''baz''' and '''qux''' (alternatively '''quux''') are sometimes used as ]s (also referred to as ]s) in ] or computer-related documentation.<ref name="rfc3092" /> They have been used to name entities such as ]s, ], and ]s 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. |
Revision as of 00:28, 5 December 2012
Not to be confused with FUBAR. For other uses, see Foobar (disambiguation). "Foo" redirects here. For FOO (Forward Observation Officer), see Artillery observer.bananas
The terms foobar /ˈfuːbɑːr/, 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.
The usage in computer programming examples and pseudocode varies; in certain circles, it is used extensively, but many prefer descriptive names, while others prefer to use single letters. Eric S. Raymond has called it an "important hackerism" alongside kludge and cruft.
History and etymology
The origins of the terms are not known with certainty, and several anecdotal theories have been advanced to identify them. The first known use of the terms in print appear in a 1965 edition of MIT's "Tech Engineering News." Foobar may have derived from the military acronym FUBAR and gained popularity because it is pronounced the same.
The etymology of foo is explored in the Internet Engineering Task Force (IETF) RFC 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. The term foo fighter was used by Allied aircraft pilots in World War II to describe various UFOs or mysterious aerial phenomena.
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.
The term foobar was propagated through computer science circles in the 1960s and early 1970s by system manuals from Digital Equipment Corporation.
Foobar was used as a variable name in the Fortran code of Colossal Cave Adventure (1977 Crowther and Woods version). The variable FOOBAR was used to contain the player's progress in saying the magic phrase "Fee Fie Foe Foo".
Usage in code
The terms are very often used in programming examples, much like the Hello World program is commonly used as an introduction. For example, foo and bar might be used to illustrate a simple string concatenation:
/* C code */ #include <stdio.h> int main() { char *foo = "Hello"; char *bar = "World!"; printf("%s %s\n", foo, bar); return 0; }
/* PHP code */ $foo = 'Hello'; $bar = array($foo, ' ', 'world', '!'); echo implode('', $bar);
Additional examples of the use of foo and bar in code are given in the entry on metasyntactic variables.
Usage in culture
$foo is the name of a Perl programming magazine, and Foo Camp is an annual hacker convention.
During the United States v. Microsoft trial, some evidence was presented that Microsoft had tried to use the Web Services Interoperability organization as a means to stifle competition, including e-mails in which top executives including Bill Gates referred to the WS-I using the codename "foo".
These terms gave the name to foobar2000, an audio player independently developed using C++, as its author was more focussed on producing a functional program than on aesthetics.
See also
- BarCamp, an international network of user generated conferences
- Foo Camp, an annual hacker event hosted by publisher O'Reilly Media
- Placeholder name
References
- ^ D. Eastlake III; et al. (2001). "Etymology of "Foo"". Internet Engineering Task Force. Retrieved 2007-11-05.
{{cite web}}
: Explicit use of et al. in:|author=
(help) - Eric S. Raymond (1996). The New Hacker's Dictionary. MIT Press. ISBN 0-262-68092-0.
- "Tech Engineering News, Volume 47". Massachusetts Institute of Technology. 1965. p. 63.
Further, it is possible to search for an effective address; e.g., if an instruction such as "add 1 foo" were used, specifying indirect addressing thru location "foo", and location "foo" contained the address of location "foobar", than an effective word search for "foobar" would find location "foo" and the location containing the "add" instruction as well.
- "Computer Dictionary Online"., computer-dictionary-online.org
- Foo-magazin.de Template:De icon
- Microsoft ploy to block Sun exposed, news.com
External links
- RFC3092 Etymology of "Foo", tools.ietf.org
- The Free Online Dictionary of Computing entry on "foo", foldoc.org
- The Jargon File entry on "foobar", catb.org
- RFC 1639 – FTP Operation Over Big Address Records (FOOBAR)