Foobar
Encyclopedia
The terms foobar /ˈfʊːbɑː/, fubar, or foo, bar, baz and qux (alternatively quux) are sometimes used as placeholder name
Placeholder name
Placeholder names are words that can refer to objects or people whose names are either temporarily forgotten, irrelevant, or unknown in the context in which they are being discussed...

s (also referred to as metasyntactic variable
Metasyntactic variable
In computer science, programmers use metasyntactic variables to describe a placeholder name or an alias term commonly used to denote the subject matter under discussion or an arbitrary member of a class of things under discussion...

s) in computer programming
Computer programming
Computer programming is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages. The purpose of programming is to create a program that performs specific operations or exhibits a...

 or computer-related documentation. They have been used to name entities such as variables, functions, and command
Command (computing)
In computing, a command is a directive to a computer program acting as an interpreter of some kind, in order to perform a specific task. Most commonly a command is a directive to some kind of command line interface, such as a shell....

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 usage in computer programming
Computer programming
Computer programming is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages. The purpose of programming is to create a program that performs specific operations or exhibits a...

 examples and pseudocode
Pseudocode
In computer science and numerical computation, pseudocode is a compact and informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading...

 varies; in certain circles, it is used extensively, but many prefer descriptive names, while others prefer to use single letters. Eric S. Raymond
Eric S. Raymond
Eric Steven Raymond , often referred to as ESR, is an American computer programmer, author and open source software advocate. After the 1997 publication of The Cathedral and the Bazaar, Raymond was for a number of years frequently quoted as an unofficial spokesman for the open source movement...

 has called it an "important hackerism" alongside kludge
Kludge
A kludge is a workaround, a quick-and-dirty solution, a clumsy or inelegant, yet effective, solution to a problem, typically using parts that are cobbled together...

 and cruft
Cruft
Cruft is jargon for computer software or hardware that is of poor quality. The term originates from source code that is rewritten leaving irrelevant or unwanted data within the code.-History:...

.

History and etymology

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
FUBAR
FUBAR is an acronym that commonly means "fucked up beyond all recognition/any repair/all reason".-Etymology and history:The Oxford English Dictionary lists Yank, the Army Weekly magazine as its earliest citation: "The FUBAR Squadron.....

 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.

FOO is an abbreviation of Forward Observation Officer, a British Army
British Army
The British Army is the land warfare branch of Her Majesty's Armed Forces in the United Kingdom. It came into being with the unification of the Kingdom of England and Scotland into the Kingdom of Great Britain in 1707. The new British Army incorporated Regiments that had already existed in England...

 term in use as early as the First World War
World War I
World War I , which was predominantly called the World War or the Great War from its occurrence until 1939, and the First World War or World War I thereafter, was a major war centred in Europe that began on 28 July 1914 and lasted until 11 November 1918...

. The etymology of foo is explored in the Internet Engineering Task Force
Internet Engineering Task Force
The Internet Engineering Task Force develops and promotes Internet standards, cooperating closely with the W3C and ISO/IEC standards bodies and dealing in particular with standards of the TCP/IP and Internet protocol suite...

 (IETF) Request for Comments
Request for Comments
In computer network engineering, a Request for Comments is a memorandum published by the Internet Engineering Task Force describing methods, behaviors, research, or innovations applicable to the working of the Internet and Internet-connected systems.Through the Internet Society, engineers and...

 3092, which notes usage of foo in 1930s cartoons including The Daffy Doc
The Daffy Doc
The Daffy Doc is a 1938 Looney Tunes cartoon starring Porky Pig and Daffy Duck. This cartoon was producedby Leon Schlesinger, and released by Vitaphone and Warner Bros.- Plot :...

(with Daffy Duck
Daffy Duck
Daffy Duck is an animated cartoon character in the Warner Bros. Looney Tunes and Merrie Melodies series of cartoons, often running the gamut between being the best friend and sometimes arch-rival of Bugs Bunny...

) and comic strips, especially Smokey Stover
Smokey Stover
Smokey Stover is an American comic strip written and drawn by cartoonist Bill Holman, from 1935 until he retired in 1973. Distributed through the Chicago Tribune, it features the wacky misadventures of the titular fireman, and had the longest run of any comic strip in the "screwball comics"...

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" (written in logic notation). 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
Tech Model Railroad Club
The Tech Model Railroad Club is a student organization at the Massachusetts Institute of Technology , and one of the most celebrated model railroad clubs in the world, because of its historic role as a wellspring of hacker culture...

 (TMRC). In the complex model system there were scram
Scram
A scram or SCRAM is an emergency shutdown of a nuclear reactor – though the term has been extended to cover shutdowns of other complex operations, such as server farms and even large model railroads...

 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
Om mani padme hum
is the six syllabled mantra particularly associated with the four-armed Shadakshari form of Avalokiteshvara , the bodhisattva of compassion...

.' 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
Digital Equipment Corporation
Digital Equipment Corporation was a major American company in the computer industry and a leading vendor of computer systems, software and peripherals from the 1960s to the 1990s...

.

Foobar was used as a variable name in the Fortran
Fortran
Fortran is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing...

 code of Colossal Cave Adventure
Colossal Cave Adventure
Colossal Cave Adventure gave its name to the computer adventure game genre . It was originally designed by Will Crowther, a programmer and caving enthusiast who based the layout on part of the Mammoth Cave system in Kentucky...

(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 */
  1. include


int main
{
char foo[] = "Hello";
char bar[] = "World!";
printf("%s %s\n", foo, bar);

return 0;
}






/* PHP code */

Namespace Foo\Bar;

class Baz {
function Bag {
return __NAMESPACE__;
}
}

use Foo;
echo Foo\Bar\Baz::Bag; // Foo\Bar

Usage in culture

$foo is the name of a Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...

 programming magazine, and Foo Camp
Foo Camp
Foo Camp is an annual hacker event hosted by publisher O'Reilly Media. O'Reilly describes it as "the wiki of conferences", where the program is developed by the attendees at the event, using big whiteboard schedule templates that can be rewritten or overwritten by attendees to optimize the schedule...

 is an annual hacker convention (the name is also a backronym
Backronym
A backronym or bacronym is a phrase constructed purposely, such that an acronym can be formed to a specific desired word. Backronyms may be invented with serious or humorous intent, or may be a type of false or folk etymology....

 for Friends of O'Reilly
O'Reilly Media
O'Reilly Media is an American media company established by Tim O'Reilly that publishes books and Web sites and produces conferences on computer technology topics...

, the event's sponsor).

During the United States v. Microsoft
United States v. Microsoft
United States v. Microsoft was a set of civil actions filed against Microsoft Corporation pursuant to the Sherman Antitrust Act of 1890 Section 1 and 2 on May 8, 1998 by the United States Department of Justice and 20 U.S. states. Joel I. Klein was the lead prosecutor...

 trial, some evidence was presented that Microsoft had tried to use the Web Services Interoperability
Web Services Interoperability
The Web Services Interoperability Organization is an industry consortium chartered to promote interoperability amongst the stack of web services specifications. WS-I does not define standards for web services; rather, it creates guidelines and tests for interoperability...

 organization as a means to stifle competition, including e-mails in which top executives including Bill Gates
Bill Gates
William Henry "Bill" Gates III is an American business magnate, investor, philanthropist, and author. Gates is the former CEO and current chairman of Microsoft, the software company he founded with Paul Allen...

 referred to the WS-I using the codename "foo".

See also

  • BarCamp
    BarCamp
    BarCamp is an international network of user-generated conferences . They are open, participatory workshop-events, the content of which is provided by participants. The first BarCamps focused on early-stage web applications, and were related to open source technologies, social protocols, and open...

    , an international network of user generated conferences
  • Foo Camp
    Foo Camp
    Foo Camp is an annual hacker event hosted by publisher O'Reilly Media. O'Reilly describes it as "the wiki of conferences", where the program is developed by the attendees at the event, using big whiteboard schedule templates that can be rewritten or overwritten by attendees to optimize the schedule...

    , an annual hacker event hosted by publisher O'Reilly Media
  • Placeholder name
    Placeholder name
    Placeholder names are words that can refer to objects or people whose names are either temporarily forgotten, irrelevant, or unknown in the context in which they are being discussed...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK