“Foo” and “bar” as metasyntactic variables were popularised by MIT and DEC, the first references are in work on LISP and PDP-1 and Project MAC from 1964 onwards.
Many of these people were in MIT’s Tech Model Railroad Club, where we find the first documented use of “foo” in tech circles in 1959 (and a variant in 1958).
Both “foo” and “bar” (and even “baz”) were well known in popular culture, especially from Smokey Stover and Pogo comics, which will have been read by many TMRC members.
Also, it seems likely the military FUBAR(F*cked Up Beyond All Repair) contributed to their popularity.
编程里面的foo和bar就是我们小时候写作文里面的小明和小红。写作文的时候,当然情节最重要,花时间去想角色的名字太麻烦了,就干脆叫小明小红好了。