Welcome to my little CS trivia series. Every week I will post a new trivia piece because it seems that my mind is made of pieces of knowledge that don't make one knowledgeable but certainly serve as a good conversation starter (or, killer).
Today's question is...
Where did the cursed 'foo' and 'bar' come from?!
Now, you may already tell that I do not love these two fellows. In fact, I am not alone: read Daniel Warren or Derek Shanks who also admit confusion over these nonsensical examples.
Tutorial after tutorial, I contained my frustration patiently as I thought that maybe there is a deeper meaning or story behind these good-for-nothing placeholders. Well...
FUBAR, in American army jargon, means "f—- up beyond repair". The word came into use during WW2, and in programming context in 1965 in an MIT journal.
Now, Wikipedia provides us with ideas on other equally useful placeholder names, such as:
foobar, foo, bar, baz, qux, quux, quuz, corge, grault, garply, waldo, fred, plugh, xyzzy, and thud
or, in the UK:
wibble, wobble, wubble, and flob
and then, French:
toto, tata, titi, tutu
I still prefer naming my examples in any relatable way that makes it easier to figure out what is happening in the code from from the get-go.