问题
These words seem to be widely used to naming variables. What do these words stand for and why are they so frequently used? By the way, what's the origins of them?
回答1:
These two words are just placeholders in computer programs. Wikipedia https://en.wikipedia.org/wiki/Foobar seems have a good answer. There are several origin of foo:
- A nonsense word in the 1930s comic Smokey Stover by Bill Holman due to having seen it on bottom of a jade Chinese figurine in Chinatown, San Francisco, meaning "good luck".
- US Army WWII acronym FUBAR, "F-ed Up Beyond All Recognition", which also explains the origin of bar.
- The use of foo in a programming context is generally credited to the Tech Model Railroad Club (TMRC) of MIT from circa 1960.
回答2:
It comes from the term FUBAR, which again stands for Fucked Up Beyond All Repair/Recognition. More on it from Wikipedia, here https://en.wiktionary.org/wiki/FUBAR
回答3:
They have been used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept. The words themselves have no meaning in this usage. Foobar is sometimes used alone; foo, bar, and baz are sometimes used, when multiple entities are needed.
来源:https://stackoverflow.com/questions/34037458/what-does-foobar-or-foo-or-bar-mean