Race conditions at my local supermarket
I seem to have a knack for triggering race conditions in software. There's something about the way I do things or the speed at which certain things happen which leads to badness. This isn't just in the nerd arenas of home computers or video games, either. I'm talking about normal consumer-facing devices which you would not expect to crash or otherwise fail.
My latest example comes from the self-checkout lanes at a local supermarket. Their systems look like they haven't changed much from the days when credit cards were first accepted in grocery stores. Back in those days, they tended to bolt a little numeric keypad which looked like a calculator next to the existing cash register keyboard. At the end of a sale, the person running that register would key in your total.
At that point, their little card reader would come to life and demand payment. You'd do the song and dance with that thing, and it would print a receipt. They'd spin it around, tear it off, and hand it to you to sign. Once you did that, they'd hit some kind of "payment" button on their register, and, wouldn't you know it, their cash drawer would pop open. The register had no idea what had actually happened and that no cash was involved. They'd just close the drawer and carry on with life.
Things have improved a little. They no longer have to manually tell the credit card box just how much to bill. However, in far too many places, they are still separate boxes. That's where the trouble began for me.
When using these systems, I know there are a pair of state machines running in parallel. One of them is figuring out what I'm buying, and the other is going to wait for me to give it payment details. Then they sync up and talk later on, but only once they've been told to go and look for it. I use this opportunity to select credit and swipe my card so that I can return it and my pocketbook to my purse and proceed to scan my items unimpeded.
This time, I got ahead of it. I told the register "credit/debit" at around the same time I was telling the credit card terminal to run my card as credit (and not debit). What can I say? I have two hands, and I can push buttons on two different screens at the same time. This apparently made them look for each other at the same time, and they weren't having that. Their credit card terminal said, duh, okay, and sat there with a "processing" screen and a Cancel button. Meanwhile, their register said the same thing. This stage usually takes a second or two, but not today.
I sighed, and cancelled the credit card terminal, re-selected credit, fished out my card, and ran it again. It went back to the same screen. Nothing happened on the register. I sighed again, and cancelled the register, told it "credit/debit", and this time it found the waiting payment data and actually did the right thing.
Moments later I had my receipt and was done.
There is just so much fail here it's not even funny. Why are these things still two separate devices, 20 years later? Why do you have to say "credit/debit" on the main register, which really means "hey, you, go look at your auxiliary port and defer payment to some other device"? What all about the people who haven't been cursed with computer knowledge who don't think like this? They're not going to figure this out, and will just get angry.
There's also the matter of having to select credit every time. I would think by now that there would be some kind of way to determine if a given card can even do a debit transaction. Mine certainly cannot, since it's not wired up to a checking account. There is no money already behind it to debit, in other words.
It just makes no sense. You should be able to show up, swipe your physical cookie (aka "loyalty card") and payment card, and start scanning items in any order. If there are questions to be answered, pop them up and leave them there until they are addressed. When there's nothing left to scan and no other questions about payment, run it. Done.
You should not need to know about the existence of race conditions and common workarounds just to successfully buy groceries. I mean, come on.