When foo and bar is not enough [closed]

2019-03-08 00:19发布

When you are using placeholder names when programming (not necessary variable names, but labels, mockup names, etc) and foo and bar is not enough, what do you use?

I guess baz is rather common as third name, and the lorem ipsum for longer texts. But then what?

26条回答
我欲成王,谁敢阻挡
2楼-- · 2019-03-08 00:48

When writing code examples in Stack Overflow, I prefer using the "My" prefix; that is

  • MyClass
  • MyInstance
  • MyEnumerator
  • MySingleton

You get the idea. The adventage of this approach is that everyone knows what you are talking about without going into the details too much or distracting the attention from the topic. (P.S. normally I hate the My prefix, like in "My Computer" or MySQL but I think it fits this scenario)

查看更多
等我变得足够好
3楼-- · 2019-03-08 00:49

I often use "aap", "noot", "mies", from the "Leesplankje van Hoogeveen" (The page is in Dutch only, but I'll try to explain it. It's a board with simple words and pictures for teaching children to read and more importantly all the different vowels Dutch has. The last version of the board contains 18 vowels, most of them consist of different combinations of the 'vowel letters'. I'm not sure if it's seriously used in education, but it's IMHO a great piece of Dutch cultural history)

查看更多
The star\"
4楼-- · 2019-03-08 00:49

If you find you need more names beyond baz, it probably means the mockup is getting too complicated and these names will actually make it more difficult to follow the example code. I'd just rename the symbols to use meaningful names.

(I'm not even considering the case where the throw-away code is becoming production code with all the foos and bars in it. I'm sure it never ever happens. Or else.)

Finally, not exactly conventionals yet, but here's my Turkish contributions: hede, hodo, budu & zart.

查看更多
霸刀☆藐视天下
5楼-- · 2019-03-08 00:50

Here's the jargon file entry on metasyntactic variables.

查看更多
别忘想泡老子
6楼-- · 2019-03-08 00:51

foo, baz and bar are enough. For total confusion you can combine them into foobar, foobazbar, bazfoo, foofoo and so on.

查看更多
Summer. ? 凉城
7楼-- · 2019-03-08 00:52

What's wrong with x, y, z? Or a, b, c?

查看更多
登录 后发表回答