Revision as of 22:14, 12 July 2014 editClueBot NG (talk | contribs)Bots, Pending changes reviewers, Rollbackers6,438,567 editsm Reverting possible vandalism by 94.140.231.246 to version by Staticshakedown. False positive? Report it. Thanks, ClueBot NG. (1898701) (Bot)← Previous edit | Latest revision as of 23:54, 21 December 2024 edit undoNyq (talk | contribs)Extended confirmed users5,223 editsm lc per MOS:EXPABBRTags: Visual edit Mobile edit Mobile web edit Advanced mobile edit | ||
(331 intermediate revisions by more than 100 users not shown) | |||
Line 1: | Line 1: | ||
{{Short description|Placeholder names in programming}} | |||
{{Distinguish|FUBAR}} | {{Distinguish|FUBAR|foobar2000|FUBAR (TV series)}} | ||
{{Redirect|Foo|other uses|Foo (disambiguation)}} | {{Redirect|Foo|other uses|Foo (disambiguation)}} | ||
]]] | |||
{{Use dmy dates|date=February 2020|cs1-dates=y}} | |||
The terms '''foobar''' ({{IPAc-en|ˈ|f|uː|b|ɑr}}), |
The terms '''foobar''' ({{IPAc-en|ˈ|f|uː|b|ɑr}}), '''foo''', '''bar''', '''baz, qux, quux''',<ref>{{Cite web |editor-last=] |title=The on-line hacker Jargon File, version 4.4.8. metasyntactic variable |url=http://www.catb.org/jargon/html/M/metasyntactic-variable.html |access-date=2024-05-30 |website=]}}</ref> and others are used as ]s and ]s in ] or computer-related documentation.<ref name="rfc3092">{{IETF RFC|3092}} - Etymology of "Foo"</ref> They have been used to name entities such as ]s, ], and ]s whose exact identity is unimportant and serve only to demonstrate a concept. | ||
The style guide for ] developer documentation recommends against using them as example project names because they are unclear and can cause confusion.<ref name="Google">{{cite web |title=Example domains and names {{!}} Google developer documentation style guide |url=https://developers.google.com/style/examples#example-project-names |website=Google for Developers |access-date=26 June 2023 |language=en |date=2023-06-23 |quote=Ensure that the name is applicable to the user's environment. Don't use unclear terms like foo, bar, and baz.}}</ref> | |||
The usage in ] examples and ] varies; in certain circles, it is used extensively, but many prefer descriptive names, while others prefer to use single letters. ] has called it an "important hackerism" alongside ] and ].<ref name="Raymond">{{cite book|url=http://books.google.com/books?id=g80P_4v4QbIC&lpg=PP1&pg=PA5|title=The New Hacker's Dictionary|author=]|publisher=]|year=1996|isbn=0-262-68092-0}}</ref> | |||
== History and etymology == | == History and etymology == | ||
It is possible that ''foobar'' is a playful ] to the ]-era military slang ] (''fucked up beyond all recognition)''.<ref name="dictionary">{{Cite web|url=https://www.dictionary.com/e/foo/|title=What does foo mean?|publisher=]|access-date=2019-08-17}}</ref> | |||
According to a ] from the ], the word FOO originated as a ] with its earliest documented use in the 1930s comic '']'' by ].<ref name="rfc30922">{{cite web|last1=Eastlake|first1=D|last2=Manros|first2=C|last3=Raymond|first3=E|title=Etymology of "Foo"|url=http://www.ietf.org/rfc/rfc3092.txt|website=The Internet Engineering Task Force|accessdate=17 April 2016}}</ref> Holman states that he used the word due to having seen it on the bottom of a jade Chinese figurine in ], purportedly signifying "good luck".<ref>{{Cite web|url=https://www.smokey-stover.com/history.html|title=The History of Bill Holman|date=2007-06-13|publisher=]|access-date=2019-08-17}}</ref> If true, this is presumably related to the Chinese word '']'' ("{{lang|zh|福}}", sometimes transliterated ''foo'', as in '']''), which can mean ''happiness'' or ''blessing''.<ref>Mieke Matthyssen, "Chinese happiness: A proverbial approach to popular philosophies of life", p. 190, ch. 9 in, Gerda Wielander, Derek Hird (eds), ''Chinese Discourses on Happiness'', Hong Kong University Press, 2018 {{ISBN|9888455729}}.</ref> | |||
]<!-- no italics, character’s name --> driving a "foomobile", with ''phoo'' visible on the front]] | |||
The word ''foo'' originated as a ] from the 1930s, the military term ] emerged in the 1940s, and the use of ''foo'' in a programming context is generally credited to the ] (TMRC) of ] from circa 1960.<ref>{{cite web|url=http://www.ietf.org/rfc/rfc3092.txt|title=Etymology of "Foo"}}</ref> However, the precise relationship of these terms is not known with certainty, and several anecdotal theories have been advanced to identify them. | |||
The etymology of ''foo'' is explored in the ] (IETF) RFC 3092, which gives the earliest documented use as being in the 1930s comic '']'' by ], where it is used as a nonsense word.<ref name="jargon">http://catb.org/jargon/html/F/foo.html foo</ref><ref>http://catb.org/jargon/html/index.html</ref> Holman states that he used the word due to having seen it on bottom of a jade Chinese figurine in ], meaning "good luck".<ref>http://www.smokey-stover.com/history.html</ref><ref></ref><ref>http://members.aol.com/EOCostello/</ref> This is presumably as a transliteration of the ] (fú, 福), which is a common character for fortune, and figurines of the trio of eponymous male "star gods" '']'' are common in Chinese communities; compare ], fictional character popular in the 1930s. ''Smokey Stover'' ran 1935–73, and continued to feature ''foo'' prominently, as on the front of the "foomobile" illustrated in the cover at right. The word ''foo'' became very popular in the 1930s, and also appeared in other cartoons including the '']'' cartoons of ] such as '']'' and '']'' (both 1938, with ] and ]), and in other comic strips such as '']''. | |||
From there, the Foo migrated into military slang, merged with "FU" of the ].<ref name="rfc3092">{{cite web|url=http://www.ietf.org/rfc/rfc3092.txt|title=Etymology of "Foo"|author=D. Eastlake III et al.|year=2001|publisher=]|accessdate=2007-11-05}}</ref> The term '']'' was used by ] aircraft pilots in ] to describe various ] or mysterious aerial phenomena. | |||
⚫ | The first known use of the terms in print in a programming context appears in a 1965 edition of MIT's |
||
⚫ | {{ |
||
The term ''foobar'' was propagated through computer science circles in the 1960s and early 1970s by system manuals from ].{{citation needed|date=May 2009}} ''Foobar'' was also used as a variable name in the ] code of '']'' (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 ] program is commonly used as an introduction. For example, ''foo'' and ''bar'' might be used to illustrate a simple string concatenation: | |||
<syntaxhighlight lang="c"> | |||
/* C code */ | |||
#include <stdio.h> | |||
int main() | |||
{ | |||
char *foo = "Hello"; | |||
char *bar = "World!"; | |||
fprintf(stdout, "%s %s\n", foo, bar); | |||
return 0; | |||
⚫ | } | ||
</syntaxhighlight> | |||
Also see ]. | |||
⚫ | The first known use of the terms in print in a programming context appears in a 1965 edition of MIT's '']''.<ref>{{cite book|url=https://books.google.com/books?id=aOQRAQAAMAAJ&q=foobar|title=Tech Engineering News|volume=47|year=1965|publisher=]|page=63|quote=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", then an effective word search for "foobar" would find location "foo" and the location containing the "add" instruction as well.}}</ref> The use of ''foo'' in a programming context is generally credited to the ] (TMRC) of ] from {{circa|1960}}.<ref name="rfc3092" /> In the complex model system, there were ] switches located at numerous places around the room that could be thrown if something undesirable was about to occur, such as a train moving at full power towards 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 '].' Our first obligation is to keep the foo counters turning."<ref>{{cite web|url=https://www.computer-dictionary-online.org/definitions-f/foo.html|title=Computer Dictionary Online}}, computer-dictionary-online.org</ref> One book{{which|date=November 2010}} describing the MIT train room describes two buttons by the door labeled "foo" and "bar". These were general-purpose buttons and were often repurposed for whatever fun idea the MIT hackers had at the time, hence the adoption of foo and bar as general-purpose variable names. An entry in the ''Abridged Dictionary of the TMRC Language'' states:<ref>{{cite web|url=http://tmrc.mit.edu/dictionary.html#FOO|title=Abridged Dictionary of the TMRC Language|publisher=Tech Model Railroad Club of ]|access-date=2013-03-12|archive-url=https://web.archive.org/web/20180102215225/http://tmrc.mit.edu/dictionary.html#FOO|archive-date=2 January 2018|url-status=dead}}</ref> | ||
⚫ | == |
||
''$foo'' is the name of a ] programming magazine,<ref> {{de icon}}</ref> and ] is an annual ]. | |||
⚫ | {{Blockquote|text = Multiflush: stop-all-trains-button. Next best thing to the red door button. Also called FOO. Displays "FOO" on the clock when used.}} | ||
⚫ | During the '']'' trial, |
||
''Foobar'' was used as a variable name in the ] code of '']'' (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", a phrase from an historical quatrain in the classic English fairy tale ]. ] also used the term ''foo'' in their programming documentation in 1978.<ref name="Intel_1978_MSC86-OI"/> | |||
These terms gave the name to ], an audio player independently developed using C++, as its author was more focused on producing a functional program than on aesthetics. | |||
⚫ | ==Examples in culture== | ||
There is a character named "Master Foo" in ''Rootless Root'', a collection of ]. | |||
⚫ | * ] is an annual ]. | ||
⚫ | * ], an international network of user-generated conferences. | ||
⚫ | * During the '']'' trial, evidence was presented that Microsoft had tried to use the ] organization (WS-I) as a means to stifle competition, including e-mails in which top executives including ] and ] referred to the WS-I using the codename "foo".<ref>{{cite web | ||
| url=https://www.cnet.com/news/microsoft-ploy-to-block-sun-exposed/ | |||
| title=Microsoft ploy to block Sun exposed | |||
| date=2002-07-04 | |||
| author=Mike Ricciuti | |||
| publisher=] | |||
| access-date=2019-08-17}}</ref> | |||
* ] is an audio player. | |||
== See also == | == See also == | ||
{{Portal|Computer programming}} | {{Portal|Computer programming}} | ||
* ] | |||
⚫ | * ], an international network of user |
||
* ] | |||
⚫ | * ] |
||
* ] | |||
* ], a highly customizable audio player which name is derived from foobar | |||
* ] | * ] | ||
* ], similar placeholder text used outside programming | |||
* ] | |||
* ] | * ] | ||
* ] | |||
{{Clear}} | {{Clear}} | ||
== References == | == References == | ||
{{Reflist| |
{{Reflist|refs= | ||
<ref name="Intel_1978_MSC86-OI">{{cite book |title=MCS-86 Assembler Operating Instructions For ISIS-II Users |id=Manual Order No. 9800641A |date=1978 |edition=A32/379/10K/CP |publisher=] |location=Santa Clara, California, USA |url=https://archive.org/details/bitsavers_intelISISIblerOperatingInstructionsforISISIIUsersM_3593319/ |access-date=2020-02-29}} </ref> | |||
⚫ | }} | ||
== External links == | == External links == | ||
{{wiktionary|foobar|foo|bar}} | {{wiktionary|foobar|foo|bar}} | ||
* | |||
* , tools.ietf.org | |||
* , foldoc.org | |||
* , catb.org | * , catb.org | ||
* |
* {{IETF RFC|1639}} – FTP Operation Over Big Address Records (FOOBAR) | ||
] | ] | ||
] | ] | ||
] | |||
] |
Latest revision as of 23:54, 21 December 2024
Placeholder names in programming Not to be confused with FUBAR, foobar2000, or FUBAR (TV series). "Foo" redirects here. For other uses, see Foo (disambiguation).The terms foobar (/ˈfuːbɑːr/), foo, bar, baz, qux, quux, and others are used as metasyntactic variables and placeholder names in computer programming or computer-related documentation. They have been used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept. The style guide for Google developer documentation recommends against using them as example project names because they are unclear and can cause confusion.
History and etymology
It is possible that foobar is a playful allusion to the World War II-era military slang FUBAR (fucked up beyond all recognition).
According to a RFC from the Internet Engineering Task Force, the word FOO originated as a nonsense word with its earliest documented use in the 1930s comic Smokey Stover by Bill Holman. Holman states that he used the word due to having seen it on the bottom of a jade Chinese figurine in San Francisco Chinatown, purportedly signifying "good luck". If true, this is presumably related to the Chinese word fu ("福", sometimes transliterated foo, as in foo dog), which can mean happiness or blessing.
The first known use of the terms in print in a programming context appears in a 1965 edition of MIT's Tech Engineering News. The use of foo in a programming context is generally credited to the Tech Model Railroad Club (TMRC) of MIT from c. 1960. 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 moving at full power towards 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 labeled "foo" and "bar". These were general-purpose buttons and were often repurposed for whatever fun idea the MIT hackers had at the time, hence the adoption of foo and bar as general-purpose variable names. An entry in the Abridged Dictionary of the TMRC Language states:
Multiflush: stop-all-trains-button. Next best thing to the red door button. Also called FOO. Displays "FOO" on the clock when used.
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", a phrase from an historical quatrain in the classic English fairy tale Jack and the Beanstalk. Intel also used the term foo in their programming documentation in 1978.
Examples in culture
- Foo Camp is an annual hacker convention.
- BarCamp, an international network of user-generated conferences.
- During the United States v. Microsoft Corp. trial, evidence was presented that Microsoft had tried to use the Web Services Interoperability organization (WS-I) as a means to stifle competition, including e-mails in which top executives including Bill Gates and Steve Ballmer referred to the WS-I using the codename "foo".
- foobar2000 is an audio player.
See also
- Alice and Bob
- Foo fighter
- Foo was here
- Fu (character)
- Lorem ipsum, similar placeholder text used outside programming
- xyzzy
- Category:Variable (computer science)
References
- Eric S. Raymond (ed.). "The on-line hacker Jargon File, version 4.4.8. metasyntactic variable". Jargon File. Retrieved 2024-05-30.
- ^ RFC 3092 - Etymology of "Foo"
- "Example domains and names | Google developer documentation style guide". Google for Developers. 2023-06-23. Retrieved 2023-06-26.
Ensure that the name is applicable to the user's environment. Don't use unclear terms like foo, bar, and baz.
- "What does foo mean?". Dictionary.com. Retrieved 2019-08-17.
- Eastlake, D; Manros, C; Raymond, E. "Etymology of "Foo"". The Internet Engineering Task Force. Retrieved 2016-04-17.
- "The History of Bill Holman". Smokey Stover. 2007-06-13. Retrieved 2019-08-17.
- Mieke Matthyssen, "Chinese happiness: A proverbial approach to popular philosophies of life", p. 190, ch. 9 in, Gerda Wielander, Derek Hird (eds), Chinese Discourses on Happiness, Hong Kong University Press, 2018 ISBN 9888455729.
- Tech Engineering News. Vol. 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", then 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
- "Abridged Dictionary of the TMRC Language". Tech Model Railroad Club of MIT. Archived from the original on 2018-01-02. Retrieved 2013-03-12.
- MCS-86 Assembler Operating Instructions For ISIS-II Users (A32/379/10K/CP ed.). Santa Clara, California, USA: Intel Corporation. 1978. Manual Order No. 9800641A. Retrieved 2020-02-29.
- Mike Ricciuti (2002-07-04). "Microsoft ploy to block Sun exposed". CNET. Retrieved 2019-08-17.
External links
- Google developer documentation style guide word list
- The Jargon File entry on "foobar", catb.org
- RFC 1639 – FTP Operation Over Big Address Records (FOOBAR)