Buying Fish Concurrently

Architectural patterns practically pop up everywhere and in places least expected.  An example of this is Starbucks does not use two-phase commit.  Recently at my local farmers market, I came across the need to leverage another one.

I typically purchase fruit, vegetables and fresh fish at my farmers market. The fruit and vegetables stalls are located right at the front of the market with the fish located at the back.  Purchasing fruit and vegetables is generally pretty straightforward as I just pick up what I want, it’s buying fresh fish that gets a lot more involving.

It starts off with  getting a ticket for getting in line to be attended too.  Once your number is called, you get to select the fish you want and the preparation method of choice. After you’ve selected your fish and preparation method, the fish is taken to a preparation station where it is cleaned and cut (if you so choose).  Once it has been cleaned based on your instructions, the fish is bagged and returned to you for pick up.

Because of the dependency involved in buying the fish (cleaning and cutting), fish buying general takes some time with lines of people waiting for their fish to be processed.  Even though it is managed in an asynchronous fashion i.e. you place your order and someone else is attended too, its still a time consuming operation and the average wait for fish is anywhere between 10 and 30 minutes depending on how many people came to buy fish.  This operation could probably be sped up by the Farmers Market dedicating more resources to cutting and cleaning fish, but it doesn’t look like that will happen anytime soon.  Besides, adding more resources is completely out of my control.

The fact that it takes 30 minutes to buy fish is not inherently bad.  It’s the fact that the fish stall happens to be at the back of the farmers market.  Let me explain what I mean here.  The average shopper (including myself) will pick up fruits and vegetables before buying fish simply because the fruit and vegetables are the first things the shopper will see.  However, picking up fruits and vegetables is not time consuming at all because the only dependency is the shopper i.e. I can move from fruit stall to fruit stall at my own pace with no external dependencies.  However, once I hit the fish section, I am now dependency of the fish order processing system.  It is guaranteed that my shopping time will take at least the time the “fish buying process” takes plus however long it took me to pick up my fruits and vegetables.

Now imagine for a moment that instead of instead of picking up my fruits before fish, I actually went and placed my order for fish and then came back and picked up my fruit and vegetables?  In essence, I would have two operations occur concurrently and the total time for shopping could theoretically be shaved in half.  While I would have to check in on my fish order (to make sure someone else didn’t take my fish!!), I would be assured that it was being processed and could do other shopping in the time my fish order was being processed.

This pattern can be used in the architecture of software systems by identifying activities of a business process that can be run in parallel or asynchronously without impacting each other.  This is particularly important when the processes in question are external systems but is still applicable even with internal systems.  With multi-core systems, this also allows system resources to be leveraged to their fullest capacity.

A little lesson from your friendly Farmers Market.


Nigerian 419 and the recession

The Washington Post recently published an online article on how the hard economic times are impacting scammers in Nigeria and possibly making them more creative and ingenious.

Being from Nigeria and living in the US, I did find this article somewhat intriguing.  I still don’t quite understand how people (and sometimes corporations) are so easily duped.  It can’t just be greed or can it?  The classic, “I need your help transferring money…” is just so over the top.

My observation is that articles on internet fraud focus on the methods of the scam.  I haven’t seen any reports on the demographics of those being duped or any analysis on why such people are being duped.  Is there any information of this type out there?

Personally, I feel that there are a lot of handicapped people that are falling victims to these scams and these people need both help and education.  I know of at least one handicapped individual who had a “girlfriend” in Nigeria that he was sending money too almost daily.   He wouldn’t have stopped except for the fact that someone called his “girlfriend” and asked “him” to leave this individual alone.

I’d be interested to get other thoughts on this.