Thought the title would get your attention. But I promise I'll hit both topics in this post, no false advertising here, nosiree.
We ended up in Mr Price Home earlier today, picking up wedding presents for a friend (they had a registry there). Two things struck me while waiting in line.
The first was a decidedly bizarre (in my mind) range of bedding. The big promotional poster had two reasonably attractive young women (I'd guess in their late thirties) laughing and frolicking (I have no better word for it) in their pyjamas on a large bed. Individual items carried different imagery but kept to the theme. My first thought is that it was a misguided attempt to convey the fun awaiting the person who decides to make a purchase from the range. But upon further thought I realised that Mr P may well be onto something. Perhaps what they're really trying to do is tap into the market segment made up of men who desperately want to own bedding favoured by lesbian women in their mid to late thirties with a tendency to frolick with their partners in front of a photographer. Cunning. I can't say for sure, but I'd be prepared to put money on this being an entirely untapped niche market.
The second thing I noticed was that Mr Price has absolutely no understanding of multithreading. When we arrived and asked about the gift registry, they dug up and handed us a printed fax with a list of items on it. There are already two serious problems here. The first is that, being a fax, there is at least one other copy. We asked and were told that they fax copies to each store as people arrive and ask about that particular registry. The problem with this is that there's no way to prevent multiple purchases of the same item on the list. You may have asked for two towels guys, you may well receive a dozen. The second problem is that we're holding the only physical copy in that store. As a result, if someone were to show up asking for that registry while we were shopping, they'd either be told "we don't have that registry" and leave (no sale) or they'd be forced to wait for a new copy to be faxed over (at which point you're back to the first problem I mentioned: duplication).
If they're going to stick with registries being available at all stores they need some sort of centralized mutex. This doesn't scale well. An approach along the lines of optimistic updates (assume no clashes, check before committing the customer to the purchase) would probably scale better (for reasons that probably explain why the existing approach isn't a huge problem right now: low traffic) and work reasonably well. If you're prepared to limit it to a single store then you could do away with synchronization entirely by breaking the list up into sublists for individual items. Then the person who wants to buy something just takes that item's proxy (in the form of a piece of paper or something) with them. It's absence prevents others from buying that item and because each sublist contains only a single item there's no contention.
See kids, CS prepares you for anything ;-)
On the way out I was sorely tempted to just breeze past their security guards (that link may not remain valid for long, the original is here).