Five miles meandering with a mazy motion

Sometimes I think that Starbucks sets up their menu so that it’s impossible to order a drink without sounding like a complete idiot. Or maybe it isn’t their fault; we could blame the Italians. Either way, it’s a problem. Even foregoing the effete names like “venti”, “ristresso” and “macchiato”, the drink names themselves are so long and complicated, and the baristas correct you in a passive-aggressive way if you get them wrong. I think there’s a better way.

Essentially, the name of a drink encodes a variety of choices. What size? What kind of milk? What temperature? And so on. Encoding those choices as words is actually fairly inefficient: were this a computer, we’d encode them as a bit vector and be done with it. Actually, this is a computer! Let’s try it.

Now, don’t get scared. A bit vector is actually a pretty simple thing — it’s just a bunch of bits — number that are either one or zero — all laid together in a line. For example, here’s one: 01001101. Here’s another one: 10010110. See? They’re not too scary. Of course, they’re not very useful if we don’t know what the different bits mean, so let’s figure out how we’d use them to describe overpriced coffee drinks.

First, we can say that the first bit tells us if the drink is hot or cold. 1 means hot and 0 means cold. Then let’s use the second and third bits to tell us how big the drink is. 00 means short, 01 is tall, 10 is grande and 11 is venti. Lastly (for now), the next two bits will tell us what kind of milk: 00 for nonfat, 01 for percent, 10 for regular and 11 for breve. We’ll assemble these right to left, just like normal numbers, so a hot tall nonfat latte would be 00011. Just to be clear, the rightmost bit is 1, meaning hot, the next two are 01, meaning tall, and the leftmost two are 00, meaning nonfat. Similarly, an iced venti breve would be 11110 and a hot grande percent would be 01101:

Of course, real drinks are far more complicated than just size, milk and temperature. There’s syrup, foam, blended drinks, tea, caffeine and tons of other geegaws and gimcracks to consider. It’s not as if that’s a barrier to coming up with the appropriate bit vector — the technique we’ve already used can be applied to any number of variables with great ease. The problem is that once you’ve worked out the details for all of those parameters, you end up with 20 or 30 bits, and I don’t think rattling off 30 “one”s and “zero”s is any better than “quad trenta light-foam half-caf sugar-free hazelnut nonfat latte with chocolate syrup on top”, although it’s not much worse.

The cool thing is that a bit vector is also a binary number, and so can be expressed as a number in any number base. Any higher number base is going to use fewer glyphs to express the same quantity, and so the resulting numbers will be shorter. For example, the binary code for the drink described above might be “1000110010010111001000100”; the decimal representation of that is “18427460”. Much shorter, although still a mouthful and difficult to remember.

There are other number bases than binary and decimal, though. In fact, you can make up any one you like, and you can use any glyphs you like to represent any quantities you like. As long as you keep track of what’s what, it’s always possible to make and use such number bases. For example, you could make a base-26 system that used A for 0 and Z for 25. If you did that, then numbers would look like words, or at least like jumbles of letters. The number we’ve been dealing with, in this system, would be “BOILOM”. Now that’s succinct.

For an example of what I’m talking about, AJ Naff helped me set up a website to demonstrate the process. You can either dial up your favorite drink and see what word comes out. You can also enter a word and see what kind of drink it means.

So how would this be used? Customers could use a website to dial up the kind of drink they’d like to order and then just say those 3 to 6 letters to the barista the next time they visited the store. A computer would decode it for them and then they could make the drink like usual. Customers could continue to order in the normal way of course, but this approach could speed things up for regular customers. You could also print the code for a drink on the receipt so that people could learn for the next time.

Now the system on display on my website isn’t what a real version of the system would look like. For starters, it’s incomplete in many ways, as I’m not especially well-versed in the details of the Starbucks menu. Once the full representation was complete, there are some other things you can do in order to improve it:

  • You might remove some letters that can get confused, like either O or Q, or letters that sound like each other when spoken, like V or B. This would tend to increase word length, but it would increase clarity in communication.
  • You’d certainly want to order the bits in the vector to make more common drinks have shorter words, by putting more common options in the less-significant bits.
  • If you don’t mind giving up the concept that these are real “words”, you can add numbers or other symbols to the character set, which would tend to reduce word length.
  • You might add two or three extra bits into the bit vector that don’t have any meaning to the decoded value, so that if a particular drink order ends up spelling a bad word, you can shuffle them and generate something else without changing the order.
  • You could version the entire bit vector structure with 2, 3 or even 4 header bits, allowing future-proofing against potential requirements to invalidate old versions of the system.
  • You don’t have to use the alphabet in order as the numbering system. You could endeavour to construct a letter ordering which would make very popular drinks spell out real words.
  • Alternately, you could use the shuffle bits and the “bad word” blocker to make certain words never generate from the tools, but allow them as inputs in particular marketing campaigns. However, overuse of this would discourage customer exploration of the word-space.

OK, OK, I got a little bit technical there. And this is really a fairly ridiculous idea, anyhow, but I wrote an algortihm to test the actual word length you could get from this and then I just decided to make a web toy out of it.

One comment

  1. Well, it appears that my drink of choice is a 10010000010 (but you already knew that). I’m tempted to ask for a BSK next time I go to Starbucks, then passive aggressively explain it to them when they don’t understand what the hell I’m talking about.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>