【问题标题】:what does "foo" and "bar" mean and why people like use them as example case? [duplicate]“foo”和“bar”是什么意思,为什么人们喜欢用它们作为例子? [复制]
【发布时间】:2016-01-22 08:25:58
【问题描述】:

在很多程序测试用例或示例用例中,我总是看到“bar”和“foo”,这两个词代表什么,为什么选择这两个词作为例子?

【问题讨论】:

  • 维基百科:Foobar.
  • 基于wiki,这些变量的名称并不重要......这个问题可以被认为是无关紧要的,但绝对是与编程相关的一个很好的问题:)(每个初学者都想知道点)
  • 它们被称为元句法变量foobar 的词源不确定。见en.wikipedia.org/wiki/Metasyntactic_variable

标签: http go memcached


【解决方案1】:

Google 可以比我更好地回答您的问题。来自wiki

foo 这个词起源于 1930 年代的一个无意义词,军事术语 FUBAR 出现在 1940 年代,而 foo 在编程环境中的使用通常归功于 MIT 的技术模型铁路俱乐部 (TMRC) 从大约 1960 年开始.[9]然而,这些术语的确切关系尚不清楚,并且已经提出了一些轶事理论来识别它们。

另外,看看这个问题:What is the origin of foo and bar? 以及这个问题:https://softwareengineering.stackexchange.com/questions/69788/what-is-the-history-of-the-use-of-foo-and-bar-in-source-code-examples

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-08-29
    • 2016-11-29
    • 2022-12-10
    • 2020-12-31
    • 1970-01-01
    • 1970-01-01
    • 2010-09-14
    相关资源
    最近更新 更多