Live data from Hacker News

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

softwareengineering.stackexchange.com

131–140 of 150 posts

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

#131

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…

I've always heard fubar originated as a backronym for the mispronounced German word "furchtbar," which means terrible but could be sort of interpreted as meaning "f'ed up." Fubar originated during WWII so it seems plausible atleast.

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

#132
post #56
post #29

Earlier quoted context omitted.

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.

This is a sexist statement

Very sexist. Women were not only expected to never cuss, but also to pretend as if they had never even heard such awful words.

https://youtu.be/Cq-If5vVvcc

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

#134

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…

My current chemo regime is FOLFIRI, one of the components of Which is Fluorouracil, and frequently written as “5-FU” and it’s a bugger.

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

#135

Earlier quoted context omitted.

There was this thing called the Jargon File. Then it was taken over by a rogue person who removed some things which didn't fit his personal liking and put in some other things. There was a lot of drama, but the end result was a skewed file that emphasized certain parts of hacker culture over others. It might be good to know that you linked to the version which one person had outsized influence of, and should probably…

Can the original be found somewhere?

https://news.ycombinator.com/item?id=41753841

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

#136

Earlier quoted context omitted.

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

I think it is actually a little funny, nowadays of course the assumption that we particularly should be less profane around women would be seen as old fashioned and kind of a bit sexist. But I guess at the time swearing less was probably seen as a way to make women less uncomfortable. And I’m sure in some cases it did help. An interesting example of the quirks we carry along with us, and the fact that the combination…

And it's not that hard to understand, it wasn't as if women would faint at hearing the word fuck, but that casual swearing made an environment feel like a boys club which used to be strongly exclusionary. Go talk to your grandmothers about it, the 60s was the start of second wave feminism— we're not talking about "they said guys to refer to a mixed group" but "how dare a skirt talk back to a man" level sexism.

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

#137

Earlier quoted context omitted.

At some point the lines crossed between people whose first exposure was the old "FUBAR" and those whose first exposure was the tech "foo/bar/baz". I wonder when it was.

I imagine that many of us who got into programming through the 1980s home computer boom encountered the terms "foo" and "bar" before we were old enough that adults would have felt comfortable using "FUBAR" around us.

In my experience, adults were comfortable saying FUBAR around kids but didn't explain it to be an acronym. I learned it simply as a regular word, which though context I understood to mean something was badly messed up.

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

#138

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…

On a related note, we all know the story from WW2 where Bastogne was surrounded by the Wehrmacht, and the Wehrmacht sent a note to General McAuliffe suggesting he surrender. He returned with a note that simply said "nuts". I simply did not believe than an American GI ever said "nuts". So, I asked my dad (WW2 veteran). He said he briefly worked for the General, and asked him what he actually wrote. The General laughed…

Next you’re gonna tell me it wasn’t “damn the torpedoes”

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

#139

Does anyone have any other successors to foo and bar? Mine have always been bis buz baz, but I don't know if they're canonical or if I just made up the next words in the sequence.

I don’t know how I started this but I’ve used the following since before I had a beard:

foo/bar/baz/bing/bang/bong

Once in a while I’ll throw “biz” in after baz. I suspect the bar/baz pairing felt like alliteration to me and I extended it.

I’ve never used it in production code of course, but I have in tests. For string interpolation or parsing tests you tend to need a lot of variables or values and you don’t care what the variable means you just want the right ones placed in or extracted from the correct spots.

In particular if the rest of the data looks legit and the bits sunstituted looks like gibberish, I find it makes the red tests’ failure message quicker to read.

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

#140
post #119

Earlier quoted context omitted.

The point is that tyoe is an EXTREMELY vaulable information and if you are explaining code to someone it is very helpful to clearly see what are keywords, what are arbitrary variable names, and what are the types of the variables. For example if you show me a programming language where there is a list object and you write list.one(), I don't know if list is a variable or a keyword, and I don't know if one is a variab…

Your argument does make sense for teaching an intro to programming type class, where it may not be obvious what is a function name versus variable name. That just hasn't been my audience for a very long time now when explaining anything. I'd likely also go with var1 var2, fn1 fn2 type names if needing non-descriptive placeholders in that case. I mainly avoid foo and bar because to me it's a tired meme, and people ten…

>Your argument does make sense for teaching an intro to programming type class, where it may not be obvious what is a function name versus variable name.

Yea but the truth is a huge of audience of people who are not super familiar with the syntax of a languague will read tutorials describing how to build stuff in that language hoping they can piece things together. So for them it would be helpful.

Also, isn't all of programming just playing with types in a way? I feel like Intro to types never stops lol.

Post reply on HN