Garbled

Efficiency in Algorithms Everywhere

I have heard UI folks talk a lot about how everything has a UI. Doors have a UI, you know? If there’s a horizontal bar, it’s clear that you’re supposed to push. If there’s a vertical bar, that invites you to pull. It’s a poor UI if you walk up and the door looks like it wants you to pull, but, in fact, requires you to push. I’ve been seeing UIs everywhere since I first heard this idea.

I realized just the other day that I also look for efficient algorithms everywhere. I think I may have been doing it for years and just not realized it. Maybe other people do this, too, but I’ve never heard anyone say it out loud in quite this way. Maybe I’m insane or OCD. I’m just going to present some that catch my eye frequently (or have recently, anyway) and rant about them. How’s that for a thesis?

The Cash Register

I often buy things at stores. Most of my transactions are via credit card. Especially when I’m buying, say, lunch, the transaction is so small that the store doesn’t ask me for my signature (let alone ID). So after placing my order, the employee tells me the total and I hand over my card. They then swipe it and stand there while we both wait for the receipt to print out and the register to see that the transaction went through. Then I get handed back a receipt (maybe with an order number) and card at the same time. I have to keep the receipt out and put the card back in my wallet. I may also have to carry away a cup to be filled with soda.

Frequently as I’m handed my receipt and card at once I’m told, “ThankyouforcomingtoRestauranthaveaniceday?” in a big rush and then glared at because it takes me a second to put my card away, pick up my receipt and cup and move along. If time is such a big deal (and during a lunch rush, let us understand that it is) that you’ll glare at a paying customer over it, perhaps an ounce of algorithmic analysis should go into minimizing it, no? If, for instance, I was handed the card back immediately, then I could put it away and be done with it before I am handed a receipt and cup. Then I can immediately move and let the next customer up. This increases the number of times the employee has to reach across the register and the number of times I have to reach to meet them, but that action takes much less time than it does for me to operate my wallet or for the credit card machine to get a response from the credit card validation server. It bugs me.

The Bus

Some people seem to think that there are two discreet tasks when boarding the bus: Waiting-in-line-to-pay-and-board and swiping-card-or-paying. This is sort of ridiculous to me. Clearly you can get your money or card out while you wait. In fact, unless you just managed to catch it in time, you probably saw the bus coming a block away or so, which gives you plenty of time to discover that your bus card is not in the pocket of your backpack that you thought it was and frantically search for it before (whew) finding it… all without making several other people wait.

What would be even more speedy, though, would be to be more organized on an even higher level: always keep your bus pass in the same place (infrequent riders, of course, won’t benefit from this). I generally ride by bike when I take the bus, which means I have to load the bike on the front before boarding. It’s not really possible to load it while holding a bus card, but I still manage to have it out and ready by the time I walk around to the front door and pay terminal thing. That’s because it’s always in the same spot in my wallet.

Making Titles For Wrap-Up Sections Sucks

The connection of this post to programming is perhaps tenuous, but hopefully you can see where I’m going. I wish laypeople knew just a little about thinking in this way and applied it to stuff like this. I like to think doing so has made my life easier and I feel like it’s let me be more courteous to those around me.

Also, this was intended to be my February post, but I was trying to come up with another example. In the interest of staying in the habit of posting, though, I’m just going to hit publish and call it done. Feel free to complain about that in the comments.