The Etymology of Foo(bar)

Bryan Moon
3 min readSep 29, 2020

--

While perusing various documentation and sample code, you have most likely encountered the variable ‘foo’ or ‘bar’. So much so, that you’ve most likely just recognized it for what it is, a general purpose variable name. But have you ever wondered why the programming community settled on ‘foo’ and ‘bar’ as the placeholder variable names in documentation?

To learn more about the terms ‘foo’ & ‘bar’, we have to travel back in time to pre WWII era. Back then, the term ‘foo’ was seen in popular comics and cartoons, and is suggested to be synonymous to a term of disgust. One of the earliest recorded mentions of the term was in a popular comic strip that appeared in the 1930’s entitled “Everybody’s” created by Bill Holman wherein a fireman would ride in his ‘foo-mobile’ and the term would appear in other nonsensical phrases such as “Where there’s foo, there’s fire” or “Many men smoke, but foo men chew”. Many fan’s of the comic understood the term to be just a nonsense word, but Holman claimed to have first seen the term in-scripted on the bottom of an apotropaic Chinese figurine, giving it a negative connotation. The use of this nonsensical expression became a popular fad across the US and began to appear in other forms of media.

While the term may have had a short lifespan in the average American’s lexicon, an evolution of the slang appeared in the nation’s military ranks in the form of an acronym, FUBAR, which likely borrowed influence from the German word ‘furchtbar’ meaningterrible. This acronym, however, stood for ‘fucked up beyond all recognition’ or ‘fouled up beyond all recognition’. Kind of fitting when put into the context of war. Radar operators that monitored air traffic activity began to call unidentifiable flying objects, ‘foo-fighters’, and the British military also began to use the term to leave their mark by spraying ‘FOO WAS HERE’ wherever they went. There is even a record of its usage in a 1964 British naval magazine that reads, “Mr. Foo is a mysterious second world war product, gifted with bitter omniscience and sarcasm.”

Finally, we get to the terms first usage in a programming context in the Tech Model Railroad Club Dictionary in 1959. This MIT club used the term prepended to ‘switches’, which were the switches placed around their club room used to prevent an undesirable outcome in their complex model train systems. This historic MIT student club is also credited with the origin of hacker culture, with some of its earlier members including Jack Dennis and Peter Samson. These ‘foo-switches’, when used, would halt the system and display a message on a digital clock that read, you guessed it, ‘FOO’. They also had two special buttons each respectively labeled ‘foo’ and ‘bar’ which were general purpose buttons they would use and re-purpose to enact any other fun idea’s they had for their systems.

The definition of ‘foo’ in the TMRC Dictionary is the only entry highlighted in red

Moving forward, we begin to see the term used in other systems manuals, as well as representing general purpose variables, methods, or commands in almost every subsequent programming language created, and I can’t help but think that the term might actually be one of the worlds greatest meme’s created. There are some other metasyntactic variable names that exist such as baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, and thud. If you ever get tired of seeing foo & bar, feel free to use one of these other nonsense names the next time you’re describing that snazzy method you learned to a friend.

--

--