My Problem with Foobar
Posted: December 28, 2009 | | Categories: Miscellaneous
I read a lot of computer books and application development books – you'd have to expect that considering what I do for a living. Recently I've been catching up on some of my Joomla! books and of course reading the BlackBerry development books that followed mine and there's something that always bothers me in these types of books and I thought I'd rant about it a little bit…
In most development books, the authors always use 'foo', 'bar' and/or 'foobar' as sample function names in their sample code. What I can never tell is whether the person using those terms understands what they're doing or whether someone did it once and everyone else just followed.
Let me give you some background:
A very long time ago (who knows how far back – Wikipedia says it was in 1944) some army grunt used the term FUBAR to describe something that was 'mucked up beyond all recognition' or 'mucked up beyond all repair' (depending on which version of the story you hear) substituting an 'F' for the 'M' in mucked of course. The term was apparently very widely used in the US army (or so my father told me from his experiences in the Korean War).
What I can't figure out is how the term got mangled into something that's used so often in computer books. The term is clearly not something that you'd expect to people to use in a book, so I guess that's how it became foobar instead of FUBAR. Probably mostly because it would be too easy to mispronounce 'fu' as perhaps fuh instead of foo – so that's why 'they' made it 'foo'? Anyway, why is this being used? I'm not offended by the term, but it is a crude and impolite word to use in a regular, every day book.
If you read the Wikipedia reference for FUBAR and foobar, the writers there have clearly tried to pretend that the words are not related (confusingly the FUBAR page says they're not related: 'Not to be confused with foobar' but the foobar page mentions that foobar may actually be related to FUBAR). How could they not be referring to the same word? Some developer geek heard about the expression and started using it in his sample code and before we know it, it's being used everywhere. Why can't the sample function names be something like function1
& function2
or somefunction
& anotherfunction
instead of foo
and `bar? It just doesn't make sense to me.
The reason this all came to mind I guess was that many people use words like this without really knowing what they're saying. I purchased much of the furniture in my house from a family run furniture company in Amish country (although they were not an Amish family – just craftsmen living in Amish country). I was speaking to the owner's wife about a communication issue related to a delivery to my house when she said “I'm so sorry about the SNAFU.” I was completely taken by surprise by her comment – she was after all a quiet, polite lady in her late 50's or early 60's. I laughed for a minute then asked her if she knew what SNAFU meant. When she said that she didn't, I told her that that expression was another Army term standing for 'Situation Normal, All Mucked Up' (or course again substituting an 'F' for the 'M' in mucked). She was shocked and stunned and quickly promised “I'll never use that term again!”
Anyway, feel free to disagree with me, but I'm certain the initial use of foobar in computer sample code was a sort of trick played by some geek a long time ago and we're stuck with it in every new computer book that comes out. I wish people would drop it – again, it's not that I'm offended by it, I just think it's stupid to have that expression (although a slightly modified one) used in professionally produced books. I wish the editors would all get together and ban that term from all code examples in computer books going forward. I promise that you won't find the expression in BlackBerry Development Fundamentals and in any other book I write!
Next Post: AT&T wants the FCC's blessing to shut down PSTN
Previous Post: Internet Scam 20091216
If this content helps you in some way, please consider buying me a coffee.
Header image: Photo by Marcos Paulo Prado on Unsplash