views:

744

answers:

29

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?

+1  A: 

moo, cow, sheep, baa (in that order).

Greg
+18  A: 

If an example is that complex, it would probably be easier to understand if you just used real variable names.

Marc Charbonneau
+3  A: 

People at my work have a curious affinity for "monkey"

Dominic Rodger
"A curious affinity for monkey" is a great name for an album or possibly a band.
Kev
Too bad you can't mod up comments! =P
Erik Forbes
@Erik, now you can ;)
hasen j
+1 I used monkey and banana in a SO question yesterday and apparently it really speaks to people :-) http://stackoverflow.com/questions/1299910/event-delegate-or-interface
Wim Coenen
+18  A: 

From Wikipedia:

A "standard list of metasyntactic variables used in syntax examples" is: foo, bar, baz, qux, quux, corge, uier, grault, garply, waldo, fred, plugh, thud, mos, henk, def.

Bombe
Never heard or saw any of those except foo and bar.
GoodEnough
I've never gotten beyond qux, myself.
Paul Tomblin
I saw quux in the Mercurial book...
PhiLho
I'm sure there's a bit of tongue-in-cheek to this list...
Skilldrick
'def' wouldn't work in languages where it's a keyword, like groovy. +1 though, 'cause i was oblivious to life beyond foo, bar, and baz :)
Rob Hruska
I know and remember the first five but only from reading them. I must admit that I don’t use these variable names in my code. There’s always a better variable name. :)
Bombe
I want to be Mos Def.
JesperE
Uier? Really? That's udder in Dutch, you know? Will never use that name. ;-)
peSHIr
The reference given with that list doesn't contain many of the words on wikipedia. This seems to be total nonsense ;)
eelco
BTW, I fixed the wikipedia page.
eelco
+8  A: 

For arbitrary names beyond bar, I've always gone with inky, pinky, blinky, and in exceptional cases, clyde.

Phantom Watson
+1  A: 

Jim and Bob use to be a fav at uni :-)

WestDiscGolf
I often use bob and jake. Then I switched to a and b because they were shorter.
Kev
A: 

Don't forget the ever popular "bubba".

Brian Knoblauch
+1  A: 

In Expert C Programming: Deep Secrets, Peter van der Linden used vegetables.

PolyThinker
A: 

and for OOP Thingoid...

Tony Lambert
+2  A: 

take a dictionary and start at aardvark :)

nEJC
+2  A: 

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

pi
A: 

After foo, bar, baz and qux, which are the only canonical ones I can remember, I tend to use "META_SYNTACTIC_VARIABLE_1", "META_SYNTACTIC_VARIABLE_2", or just "$VAR1", "$VAR2" and so on.

Paul Tomblin
+4  A: 

in France we use "toto", "tata", "titi" etc... instead of foo and bar... ("tyty" is rarely used)

Vinze
Sometime I also use ga, bu, zo, meuh... http://www.lesshadoks.com/
PhiLho
+4  A: 

Names of swedish vegetables and fruits: gurka, tomat, banan. Bonus points if you have å, ä, or ö in the variable names. :-)

JesperE
A: 

In Italy, Disney characters are faves: Pippo, Paperino, Topolino, (resp. Goofy, Donald, Mickey). Italy is, or was, the second country in Disney Popularity after the USA.

Adriano Varoli Piazza
+5  A: 

Here's the jargon file entry on metasyntactic variables.

unbeknown
+1  A: 

Pick a theme and use it.

Or use CPAN's ACME::MetaSyntactic to generate them for you. Lots of themes out of the box.

JB
+1  A: 

It's probably a better habit to use names related to the problem, since this will aid communication.

But in cases where you are working in the abstract and really don't want the names to matter, there are lists of commonly-used metasyntactic variables available in the Jargon File (which lists several different progressions) or from Wikipedia (currently "foo, bar, baz, qux, quux, corge, uier, grault, garply, waldo, fred, plugh, thud, mos, henk, def").

Personally, I've never seen or used most of the unpronounceable words in those lists, but I have seen and prefer to use "foo, bar, baz, spam, fred, xyzzy."

Ultimately, any set of nonsense words should work, or any set of words that are nonsensical relative to the problem.

Some folks I know get really sick of foo, bar, et al., so an alternative is to use character names from TV shows. I frequently use "Fred, Barney, Wilma, Betty, Pebbles, BammBamm." This is particularly useful in abstract OO discussions, because "Fred is-a Flintstone" comes across pretty clearly.

system PAUSE
A: 

I typically use single-letter placeholder variable names, and strings like "This is a button" or "Here is some text" / "here is more of it" for UI stuff.

Noah Witherspoon
+2  A: 

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

peSHIr
What's wrong?! One-letter variable names aren't nearly as descriptive as "foo, bar, baz, and bah"!
Phantom Watson
Who needs ultra-descriptive in short examples, labels, mock names, etc.? There, I'd rather have something clean, short, mathlike, than "Huey, Dewey, and Louie" (what's descriptive about foo and bar anyway?). But maybe I just interpreted the question wrong?
peSHIr
A: 

My favourites in German are “wilde” and “wutz”, in conjunction, which could be translated as “wild” and “piglet”. Also, there's “barfoos”, which, when spoken, sounds like “barfuß”, German for “barefoot”.

Konrad Rudolph
A: 

imagination

Jesse
+2  A: 

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)

DrJokepu
A: 

I often go to blah after foo and bar. I usually stop there.

Chris Conway
A: 

I use the Greek alphabet, but I rarely go past delta.

job
A: 

I've also seen fee, fie, foe, fum.

felideon
A: 

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)

eelco
A: 

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.

Ishmaeel
A: 

I always like:

  • asdf
  • qwer
  • uiop

Because they are all a quick flick of one hand over all fingers, not far from your home position, and you can pronounce them (as opposed to zxcv and jkl which don't roll off the tongue quite as well :)

FWIW Common lisp has a package manager called asdf

Mark Aufflick