A Tale of a Careless Store Owner

Totally not an anti-pattern of well-written micro-services.

Once upon a time in a faraway kingdom, there was a tiny convenience store. It was small but very popular among the locals especially because of the apples. This store had to offer the finest, the biggest and the sweetest apples in town.

Customers came in long queues, and the store owner filled up their baskets with fresh apples all day long. Life couldn’t be any happier. Except that the store owner liked to sleep very much. He didn’t like it when a trader was knocking on his door early in the morning.

“Get-up sir, I brought the apple” – the trader said.
“Why can’t you come later when all my other suppliers do?” – the store owner replied.
“I have to travel to the farthest corners of the kingdom, I need to be on my way as soon as I can” – the merchant persisted.
“Eh, I give you the key to the store. Take it to the blacksmith he will make a copy for you” – closed the debate the owner.

For the time being, everybody was happy. The store owner could sleep longer, and the trader could unload his carriages any time he wished.
“What could possibly go wrong?!”
“Everybody here has the best of intentions.”
“What a fine solution!” – the store owner gave himself a pat on the back.

Months passed by, and life was thrilling. The kingdom was expanding, faraway lands have been conquered by the king. It was no longer just apples on the shelves. The early morning trader on his way back brought oranges, bananas, papayas, and much more. While the owner was asleep, he opened the storehouse again and unloaded the fruits all over the place. He mixed apples with oranges, grapes with bananas and so on.

“He really does create a mess” – the owner muttered.
“Ah, nevermind” – he continued.
“My dear customers should pick what they need or better cook a mixed fruit pie.” – concluded the debate with himself.

Life wasn’t as good as before, but still better than at most places. There was a small problem though. There was a cook who wanted the apples earlier than the shop was open.
“I have plenty of things to do, I cannot wait until that sleepyhead wakes up” – he argued.
“I don’t care how you do it, but give me my apples at dawn” – he was yelling at his scullion.
His servant was a smart boy. He knew that while the early morning trader empties his baskets the store will be unlocked. He went in and collected the finest of the apples. The cook was very pleased even gave his scullion a pay rise.

Months flew by, spring came. The apple trees were in full bloom. This was when a real tragedy occurred. An evil wizard sent a blizzard on the kingdom and froze half of the apple trees. There were famine and poverty. The king gave a strict rule to the shop owner:
“No one should buy more than two apples a day” – he ordered.
“Yes, my lord” – the store owner replied.

The shop owner did the best he could, but somehow he was always short on apples. Some customers left empty-handed, they could not even buy their two apples a day. Needless to say, the impatient chef never had to stand in line. There was always a sweet-smelling pie on his table.

The store owner has been punished harshly by the king for his negligence.
“What should I do?” – asked the owner desperately.
“I totally lost control of my business” – realized the situation.
“It would be painful to fix it, though” – he compromised.

So, the store owner continued in his old ways. As a result, some of his clients were happy some of the time. And this is how they lived sort-of happily ever after.

This is a fictional story. Any resemblance to computer systems where multiple applications or services without proper boundaries share and modify common data is purely coincidental.

Leave a Reply

Your email address will not be published. Required fields are marked *