Misplaced Pages

Foobar: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 16:11, 3 July 2007 edit63.238.141.34 (talk) Etymology← Previous edit Revision as of 14:12, 6 July 2007 edit undoDraicone (talk | contribs)2,734 editsm Examples: Fix syntax and wikicodeNext edit →
Line 18: Line 18:
Here is an example of how foo and bar might be used to illustrate a simple string concatenation: Here is an example of how foo and bar might be used to illustrate a simple string concatenation:
<br><code> <br><code>
//] code // ] code
$foo = "Hello"; $foo = 'Hello';
$bar = "World"; $bar = 'World';
$foobar = $foo . " " . $bar; $foobar = $foo . ' ' . $bar;
//$foobar now contains the string "Hello World" // $foobar now contains the string "Hello World"
</code> </code>
<br>


<br><code> <code>
//] code //] code
public static void foo() public static void foo()

Revision as of 14:12, 6 July 2007

For other uses, see Foobar (disambiguation).Not to be confused with FUBAR.

Foobar is a common placeholder name also referred to as metasyntactic variable used in computer programming or computer related documentation.

Etymology

  • Probably originally propagated through DECsystem manuals by Digital Equipment Corporation (DEC) in 1960s and early 1970s; confirmed sightings there go back to 1972. Hackers do not generally use this to mean FUBAR in either the slang or jargon sense.
  • Evolved from electronics, as an inverted foo signal; 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.
  • In RFC1639, “FOOBAR” was made an abbreviation for “FTP Operation Over Big Address Records”, but this was an obvious backronym.
  • Term used by IT consultants referring to irrelevant and redundant requests from incompetent employees. (Also see "6th Floor")

The Jargon File makes a reasonably good case that foo predates fubar.

It is also possible that these two come from physics.

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:

// PHP code
$foo = 'Hello';
$bar = 'World';
$foobar = $foo . ' ' . $bar;
// $foobar now contains the string "Hello World"

//C# code
public static void foo()
{
    bar();
}
public static void bar()
{
    foo();
}
// Neither foo() nor bar() accomplish anything useful, 
// and the use of either will lead to a stack overflow error


See also

Sources

  1. The Jargon File

External links

Categories: