http://www.perlmonks.org?node_id=372661


in reply to How do you name the possibilities?

Pizza delivery places do something like this (never worked at one, but I've received more pies than is good for me): Start with a plain cheese pizza, "". Then you start adding toppings: "P" for pepperoni, "A" for anchovies, "N" for pineapple because "P" was taken. If you have more than 26 ingredients you start adding lowercase letters: "Bp" for banana peppers, "Bq" for barbeque sauce, "Bl" for bay leaves. (You can probably take away the cheese with "Z" or perhaps "Nc".)

Chemists do this too in the periodic table.

You will probably need to define the order in which elements can appear. For example, a classic "hawaiian" pizza would be "HN" (ham and pineapple) and never "NH". You might want to sort by either alphabet or by popularity. Then you need to arrange the keys on the register so that it "respects" that ordering.

If you pick very good names up front, you can use simple abbreviations. For instance, "C" for cheese, "W" for white (non-toasted). This is very hard to do, as you pointed out, especially when the options change over time. Paradoxically, you can get away with less intuitive names if the system is more heavily used. Memorization is your friend in this case.

As already suggested, take the most common cases as defaults. When you have binary "present-or-not" decisions (like cheese), a "C" means cheese and an absence of "C" means no cheese. But when you must select one (or more) from a list, only put a default if one selection is far more frequent than its alternatives.

Here's how I might do it. I make the assumption that most customers like their buns lightly toasted (or that the restaurant will serve them that way unless instructed otherwise). I also assume that plain buns and seeded buns are both popular.

Cheese: "C": with "": without Bun: "P": plain "S": seeds Toast: "W": white "": light "D": dark
I'd list them in that order too, since they seem to make sense that way. So my lightly-toasted seeded Big Mac with cheese is "CS".