Live data from Hacker News

What is the history of the use of "foo" and "bar" in source code examples? (2012)

softwareengineering.stackexchange.com

21–30 of 150 posts

Re: What is the history of the use of "foo" and "bar" in source code examples? (2012)

#21
post #20

Earlier quoted context omitted.

Why would women in particular object to "fu" and not "foo"?

Is it not clear what “f” and “u” is short for?

Of course it is. What's not clear is what that has to do with women.

Re: What is the history of the use of "foo" and "bar" in source code examples? (2012)

#23

MIT AI Lab back in the 1960s published technical reports containing program code. The military slang 'FUBAR' f'ed up beyond all recognition, was in the student and professor engineering vocabulary. The tradition became to use 'fu' and 'bar' as nominal function names, in same manner as X and Y were nominal variables. Often in the MIT technical reports, one would see 'x = fu(y)' or 'y > bar(z)' and so forth. If you kne…

Why would women in particular object to "fu" and not "foo"?

In the 60's the belief was that they could not tolerate profanity. Or maybe it was that they'd tattle on the rest of us.

Re: What is the history of the use of "foo" and "bar" in source code examples? (2012)

#25
post #3

In addition to the military-programming history of "foo", there's also a military-programming history for the variable naming convention of "alfa", "bravo", "charlie", "delta", etc. The naming convention is known as the NATO phonetic alphabet: https://en.wikipedia.org/wiki/NATO_phonetic_alphabet

NATO phonetic alphabet is used in all areas where you have to say letters over voice. One character variable names for temp or iterator values are everywhere in programming. But I've never ever encountered one spelled out as a full transcriptions of the NATO phonetic alphabet like alfa, bravo, charlie. Exception is alpha for probability/statistics.

Some of them could potentially be a little confusing as well, such as "delta" in game development, "echo" in some networking contexts, or "uniform" in OpenGL shaders.

I don't tend to use single-letter variable names outside of the standard `for(;;)` syntax, but if I did, I don't think I'd replace them in this way.

Re: What is the history of the use of "foo" and "bar" in source code examples? (2012)

#27

I understand that these variables have a rich and long history, but if you have ever heard a professor or anybody else say "foo" in lecture you will understand why I detest them. They have absolutely no connection to the matter at hand. Since foo is often used before bar, you would think there is an ordering between the two but there doesn't have to be. They are hard to pronounce and easier to confuse. Whenever I giv…

It's like business schools using "widget" for the product and "Acme" for the company — they are dealing in concepts, not absolutes

Re: What is the history of the use of "foo" and "bar" in source code examples? (2012)

#28

MIT AI Lab back in the 1960s published technical reports containing program code. The military slang 'FUBAR' f'ed up beyond all recognition, was in the student and professor engineering vocabulary. The tradition became to use 'fu' and 'bar' as nominal function names, in same manner as X and Y were nominal variables. Often in the MIT technical reports, one would see 'x = fu(y)' or 'y > bar(z)' and so forth. If you kne…

Why would women in particular object to "fu" and not "foo"?

Back in the 1960s United States, women were often perceived as more sensitive to public profanity, compared to men of the same age.

Re: What is the history of the use of "foo" and "bar" in source code examples? (2012)

#29
post #20

Earlier quoted context omitted.

Is it not clear what “f” and “u” is short for?

Of course it is. What's not clear is what that has to do with women.

I imagine that, due to the societal expectations historically placed on women, they’ve typically had to be “the adult in the room.” Contrast this with men historically being able to get away with acting childishly (or worse). So when terminology used in the workplace is particularly vulgar, it would follow that women would take more issue with it than men.

Re: What is the history of the use of "foo" and "bar" in source code examples? (2012)

#30
post #15

I understand that these variables have a rich and long history, but if you have ever heard a professor or anybody else say "foo" in lecture you will understand why I detest them. They have absolutely no connection to the matter at hand. Since foo is often used before bar, you would think there is an ordering between the two but there doesn't have to be. They are hard to pronounce and easier to confuse. Whenever I giv…

> They have absolutely no connection to the matter at hand. Since foo is often used before bar, you would think there is an ordering between the two but there doesn't have to be. They are hard to pronounce and easier to confuse. I couldn’t disagree more. The entire point is that the variables are disconnected from the matter at hand. They’re widely recognised as placeholders, single syllable, distinctly pronounced fr…

I would agree with the comment you're responding to, too often in tutorials or especially in off hand comments here, I find their usage to assume some common but unindicated convention or subtext and obscure the concept they're trying to convey.
Post reply on HN