Jason Salas' WebLog

On-air and online: making people laugh, making people think, pissing people off

Sponsors

ASP.NET sites that kick ass

Pals with blogs

Podcasts I listen to

The true origin of "foo" and "bar" as canonical programming conventions

One thing that's perplexed, entertained and escaped me for years as a professional developer has been the reason why so many people in the programming community use “Foo” and “Bar” as their examples when showing how to do something.  I've seen this de facto convention applied mainly towards explaining object-oriented principles, but it's gotten so popular, it's right up there with “Hello world!” as a ubiquitous sample in all forms of writing software you just can't get away from (class names, variable assignment, database username/password combinations, temporary filenames, security credentials, etc.).

I'm sure there's a decent reason for why someone out there decided to start using those particular words, but here's my theory: the big-budget 1989 action movie “Tango and Cash”.  In the film, actor Kurt Russell says something along the lines of describing a less-than-desirable situation he and Sylvester Stallone are in as “FUBAR”, being an acronym for “Fucked Up Beyond All Repair”.

How this came to be so widely used in programming circles I'm not sure.  It's not kept me up nights, but the phrase stuck with me through my youth (plus the fact that I worked at Blockbuster kept it in constant mental rotation).  You can imagine my amusement when I got into development work and found it used liberally in book after book, tutorial after tutorial, across platforms and vendors.  A UNIX training course I attended years ago used this for each and every example presented, without deviation, so much that at one point I thought Foo and Bar were either commands, directories or daemons for SunOS.  Heck, I've even used it a couple of times myself.

I'm sure someone out there has a valid explanation, but this has always stuck me as funny.  If you know the answer, do drop me a line...I'd love to find out once and for all.

Comments

Larry Osterman said:

Fubar as an acronym dates from at least world war two, and probably before.

I've actually heard it as f*ed up beyond all recognition, but it's the same idea.
# May 18, 2004 11:59 PM

Jason Salas said:

Really? Interesting. I wasn't aware that the "F" word existed that far back in American history. :)
# May 19, 2004 12:01 AM

Phil said:

Check out the Jargon File entry: http://www.catb.org/~esr/jargon/html/F/foo.html

foo and bar predate Tango and Cash by a good 45 years, back to at least WWII. They've been used in programming circles since at least the 60s.

Many, many hours can be productively wasted browsing the Jargon File. Highly recommended.
# May 19, 2004 12:05 AM

Jason Salas said:

Thanks Phil! That's what I was after. I just turned 30 last month, so tragically my popular culture frame of reference doesn't go back any further than 1974. :(

I appreciate the help!
# May 19, 2004 12:08 AM

denny said:

try this link:

http://whatis.techtarget.com/definition/0,,sid9_gci748437,00.html

or this one:
http://dictionary.reference.com/search?q=fubar


also in the USAF we have the "BUFFF" which is a B-52
I'll start it out for you as "Big Ugly Fat Flying F*"
and a C-141 in green cammo paint is a "Leaping Lizzard"

# May 19, 2004 12:08 AM

ron said:

# May 19, 2004 12:59 AM

mike said:

I echo the earlier recommendation of the Jargon File, which rarely fails me, although just today I came up dry on "hork." :-(

Although per Raymond and the Jargon File "foo" and "bar," do not appear to be related to the military slang of "fubar," I thought I'd add a selection of terms that are related to the latter sense. These are from "Mrs. Byrne's Dictionary of Unusual, Obscure, and Preposterous Words." The first is probably familiar to most folks.

snafu adj/n. Situation Normal: All F*cked Up
fubar " F*cked Up Beyond All Recognition
fubb " F*cked Up Beyond Belief
fumtu " F*ucked Up More Than Usual
janfu " Joint Army/Navy F*ck Up
sapfu " Surpassing All Previous F*ck Ups
susfu " Situation Unchanged: Still F*cked Up
tarfu " Things Are REALLY F*ucked Up

# May 19, 2004 1:32 AM

Scott said:

Don't forget "cluster fucked" meaning someone in charge of something is making stupid decisions.

Check out this link about "foo", it's an RFC. http://www.faqs.org/rfcs/rfc3092.html
# May 19, 2004 2:19 AM

Heinz said:

I think I have heard it in another movie called "Forrest Gump" (one of the Vietnam scenes, if I remeber right).
# May 19, 2004 4:53 AM

Johnny Hall said:

And Saving Private Ryan (the "desk jockey" is told that it's German!).
# May 19, 2004 5:38 AM

Ron said:

my father was in WW2 an has told me the germans that were captured on the front lines were saying the word (furchtbar) meaning Terrible the oppisite of (wunderbar) meaning wounderful. The american soldiers could not say the word so they said (foobar) then it was changed again to (fubar) to express their feeling on orders given to them or a particular situation they got into

# November 26, 2007 6:59 AM

Foo and Bar — birdchan’s blog said:

Pingback from  Foo and Bar — birdchan’s blog

# February 18, 2009 3:47 PM

Jon said:

foo bar has always caused confusion for me because it was never explained why we're using these two words. For a long time I thought they were PHP keywords. I'm actually sitting in a C++ class at the very second and my teacher is compiling foo.cpp! This was the last straw for me I decided to find out where foo comes from. I still don't know, but this article did provide some interesting and funny insight.

# October 26, 2009 8:39 PM

Lebogang Melita said:

Thanks for the post. I'm about to complete a programmin assignment and the very thing thats always at the back of my head is WHAT ON EARTH IS FOO?,to answer this question once & for all,i decided to google it,my keywords for the search were "Whats the big idea about foo? (programming)" lol, glad 2 hear i'm not the only 1 in the world who was curious. I mean my first programmin lang was C, there were foo examples everywhere. Moved to C++ same thing,now that i'm doin Java,i thought not again! Lol at least i knw now thanks:-)

# March 7, 2010 5:15 AM

Jim Sheng said:

I thought it was a Japanese word.

# April 6, 2010 8:16 AM

Tweedle said:

I love that the RFC { www.faqs.org/.../rfc3092.html

} was published on April FOO-ls Day

# January 3, 2011 9:30 PM

hooher tod said:

Yes there should realize the reader to RSS my feed to RSS commentary, quite simply

# September 4, 2011 2:56 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)