Musings
muse: to turn something over in the mind meditatively and often inconclusively
Mental Tetris

In retrospect it's all quite obvious but last night, on the cusp of sleep, ruby's blocks, thread safety and stateless classes, and functional programming all came together in a moment of clarity. The blocks all clicked into place.

It's hard to expain but it's the difference between "book" knowledge and knowing.

Posted at 08:37 PM

Multithreading and lesbians

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).

Posted at 02:41 PM

Bumper sticker of the day

Keep hooting.

I'm reloading.

Posted at 03:27 PM

On friends

I have a small core of people I consider to be 'close' friends. These are the people I genuinely feel I can talk to about anything. They're also the people who put up with bullshit from me and don't have weird needs I'm expected to fulfill (or at least I don't feel strong pressure to fulfill those needs).

I say this because one of those people are back in town after an extended away period and I was reminded of these things today. This is good because some of the people who fall into this group have not just returned and it's easy to take them for granted.

I don't do small talk (the activity, not the language). This is less a result of not wanting to do it and more a result of being incredibly bad at it. If you're looking for small talk you'd be better served trying to chat up the nearest bookcase. I'm that talented.

So catching up with old friends is always a little challenging initially because everyone begins with small talk. It takes a little while to transition back onto real topics. I think this is just a form of inertia. So much of our daily interaction involves small talk that when you're faced with an opportunity to move past it it takes a little while before you realise what's in front of you.

But when you finally do it's such a relief to realise you can drop the masks, suspend the bullshit, and call a spade a spade.

Posted at 03:22 PM