5 ms·
I really dislike when people use foo and bar. Use something with some meaning imo.
by emsixteen 4y ago
I really dislike when people use foo and bar. Use something with some meaning imo.
- marssaxman 4y agoThat'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.
- ThrowawayTestr 4y agoEvidently the abstraction can also be the distraction.
- jameshart 4y agoOnce 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.
- jkingsbery 4y agoFor example - sometimes people get confused about what is meant by a "faucet," and so using "faucet" as a variable name could lead to confusion.
- civopsec 4y agoI 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.
- deleted 4y ago[deleted]
- chasil 4y agoOh, it very much has meaning. https://en.wikipedia.org/wiki/FUBAR_(disambiguation) https://en.wikipedia.org/wiki/FUBAR_(disambiguation)
- emsixteen 4y agoYeah, I know, but obviously I mean meaning in relation to the context. :)
- mh-cx 4y agoSorry 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".
- fknorangesite 4y agoWell, 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 https://en.wikipedia.org/wiki/Foobar Which is certainly how I've always understood it.
- wizofaus 4y agoIt 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".
- bitwize 4y ago"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/ https://catb.org/esr/jargon/
- kqr 4y agoYup. 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!)
- emsixteen 4y ago100% agreed. I get the point of it, I just think that it's useless in examples.