foobar

From Wikipedia, the free encyclopedia

Jump to: navigation, search

The terms foobar, foo, bar, and baz, are common placeholder names (also referred to as a metasyntactic variable) used in computer programming or computer-related documentation. These four terms are used heavily in computer science to take the place of unknown values, typically while describing a scenario where the purpose of the unknown values are understood, but their precise values are arbitrary. The words themselves have no meaning and are merely commonly used logical representations that are used much like the letters x and y are used in algebra.

Contents

[edit] Origins

In technology, the word foobar was probably originally propagated through system manuals by Digital Equipment Corporation in 1960s and early 1970s. Another possibility is that foobar evolved from electronics, as an inverted foo signal. This is because if a digital signal is active low (so a negative or zero-voltage condition represents a "1") then a horizontal bar is commonly placed over the signal label.

It is likely that the use of foo in hacker and eventually in programming context originated 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 sacred chant phrase 'foo mane padme hum.' Our first obligation is to keep the foo counters turning.”[1]

Foo has entered the English language as a neologism due to its popularity in describing concepts in computer science and is considered by many to be the canonical example of a metasyntactic variable. It is used extensively in computer programming examples and pseudocode. Eric S. Raymond has called it an "important hackerism" alongside kludge and cruft.[2]

Foo and bar paired together are apparently derived from FUBAR, but the etymology of the term "foo" is explored in the IETF Request for Comments 3092, which notes usage of "foo" in 1930s cartoons including The Daffy Duck and comic strips, especially Smokey Stover and Pogo. From there the term migrated into military slang, where it merged with FUBAR.[3]

FOO as an abbreviation of Forward Observation Officer was a British Army term in use as early as the First World War[4] The term has been adopted in other contexts. $foo is the name of a Perl programming magazine,[5] and Foo Camp is an annual hacker convention (the name is also a backronym for Friends of O'Reilly, the event's sponsor).

[edit] Examples

The term foobar or foo and bar separately are very often used in programming examples, much like the Hello World program is commonly used as an introduction.

Here is an example of how foo and bar might be used to illustrate a simple string concatenation:

//Java Code
String foo = "Hello, ";
String bar = "World";
System.out.println(foo + bar);
//Hello, World is printed to the screen by printing foo and bar

An early example of foobar being used in a famous program is its use 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".

[edit] Microsoft anti-trust lawsuit

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".[6]

[edit] See also

[edit] References

  1. ^ "Computer Dictionary Online". http://www.computer-dictionary-online.org/?q=foo. 
  2. ^ Eric S. Raymond (1996). The New Hacker's Dictionary. MIT Press. ISBN 0262680920. http://books.google.com/books?id=POlUJW3Z9McC&pg=PA5&dq=foo+jargon&ei=GnIvR8PwGJiSpgK1qIT6CQ&ie=ISO-8859-1&sig=hIE0I8TtPGKUbSU-wgDTm4hQ8ig#PPA4,M1. 
  3. ^ D. Eastlake III et al. (2001). "Etymology of "Foo"". Internet Engineering Task Force. http://www.ietf.org/rfc/rfc3092.txt. Retrieved on 2007-11-05. 
  4. ^ http://www.1914-1918.net/Diaries/wardiary-118siege.htm Extract from War Diary of 118th Siege Battery WO95/322
  5. ^ $foo PERL MAGAZIN (German)
  6. ^ Microsoft ploy to block Sun exposed

[edit] External links

Look up foobar in Wiktionary, the free dictionary.
Personal tools