Hacker News new | past | comments | ask | show | jobs | submit login

I really dislike when people use foo and bar. Use something with some meaning imo.



That's the point, though; you use 'foo' and 'bar' when you want the reader to focus on an abstraction, instead of potentially distracting them with the details of a concrete situation.


Once the ‘programming bit’ is flipped in someone’s brain, I think metasyntactic variables like foo and bar become very instinctive and easy to reason about. You have activated the part of your brain that visualizes things as abstractions with placeholders.

The problem is when foo and bar are used in material aimed at beginning programmers who are still developing that instinct and who haven’t yet got that bit set.


Evidently the abstraction can also be the distraction.


I think of a crowbar and martial arts. Ugh, it’s actually much more distracting than the serene A-B-C, X-Y-C, and so on.


For example - sometimes people get confused about what is meant by a "faucet," and so using "faucet" as a variable name could lead to confusion.



Sorry to be nitpicking:

  https://en.wikipedia.org/wiki/Foobar
"Foobar

Not to be confused with FUBAR or Foobar2000."

It's linked from FUBAR but not under "disambiguation" but "See also".


Well, yeah. But also:

> It is possible that foobar is a playful allusion to the World War II-era military slang FUBAR (Fucked Up Beyond All Recognition).

https://en.wikipedia.org/wiki/Foobar

Which is certainly how I've always understood it.


It seems the "foo" didn't come from that, but once "foo" was in wide adoption, the "bar" likely suggested itself automatically to someone familiar with "fubar".


Yeah, I know, but obviously I mean meaning in relation to the context. :)


Yup. The point of an example is to let the learner leverage their intuition about one concept to guide their understanding of the other. It requires realistic examples. Nobody has useful intuition around what a "foo" is. It contradicts the very point of an example.

(It is useful to illustrate syntax, though!)


100% agreed. I get the point of it, I just think that it's useless in examples.


"Foo" and "bar" are hacker culture signifiers, like "yo" and "word up" are hip-hop culture signifiers. Even if you don't consider yourself a part of hacker culture, understanding its history and peculiar lingo is probably a good idea if you contribute to a site known as "Hacker News".

The Jargon File, though largely historical and obsolete, is a good place to start:

https://catb.org/esr/jargon/


Why does that site have a certificate (from LE) for "www.animadance.org"?


Have seen that happen on shared hosting before.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: