‘Chocolate sauce’- software design heuristic

trip to the supermarket can teach you a lot about designing software system, shaping teams to build them and helping to understand software design…

I was recently in need of some chocolate sauce. My wife and I had enjoyed a wonderful, home-cooked Sunday lunch and I had a craving for sweetness. “Shall we get a Viennetta? I haven’t had one for years”, I proposed. “That sounds good. Let’s get some squirty cream and chocolate sauce as well” she enthused.

Without hesitation, I grabbed an eco-friendly, re-usable, re-cyclable shopping bag and headed to my local supermarket to fill it with Viennetta, squirty cream, and the all-important chocolate sauce.

The Supermarket

After slicing my way through the supermarket-trolly traffic jam at the main entrance, I shimmied my way around the dawdling potato connoisseurs in the vegetable aisles, and majestically faked to the right and went left around a confused pensioner who wasn’t sure whether he wanted to look at dairy products or cooked meats.

First checkpoint reached. I had squirty cream and it was in my hand basket. Now for the chocolate sauce…

I took the outside lane to the rear of the supermarket. Passing the in-store butcher, the freshly-baked bread, and the fresh fish on my way to the dessert aisle. Upon arrival I frantically scanned the shelves looking for the chocolate sauce.

First pass… nothing. I was so eager I couldn’t even see it. Putting all my years of yoga practice to the test, I inhaled slowly, gracefully held the air in for a few seconds, and then slowly exhaled feeling at one with the universe. I then visually scanned the shelves again in a calm methodical way.

Still no chocolate sauce!


I was being stupid. Chocolate sauce didn’t belong with the desserts. Even though chocolate sauce is used to add sweet, irresistible flavour-enhancements to desserts, it was quite clearly chocolate. So it should live with the chocolate.

Upon arrival at the chocolate aisle, I got side-tracked by some sea shell-shaped Belgian chocolates. However, I regained my composure and scanned the entire aisle 3 times for chocolate sauce.

Still no chocolate sauce!

Wait. Chocolate sauce is a ‘sauce’. It won’t be in the sauce isle will it? Surely not…

Ketchup, BBQ, mayonnaise, Levi Root’s Reggae Reggae Sauce, ‘Blow Your Mouth Off’ Hot Chilli Sauce. Nope, not here either.

Still no chocolate sauce !

At this point, my stomache feels heavy, my skin is starting to sweat, and my mind is pushing back the inevitable… there is no chocolate sauce in this supermarket!

Impossible. No. It must be located near the squirty cream since they are a frequently-paired combination. I must have walked right past the chocolate sauce in my haste to get the cream.

At this point, the anxious feeling starts to overpower my body. I know I’m getting desperate. I’m totally distraught when I get to the dairy aisle and it’s not there with the squirty cream, either.


One last roll of the dice before I had to face the harsh reality of going home without the chocolate sauce. That’s not how this perfect Sunday was supposed to end.

I scurried around looking for an assistant in the shop. I couldn’t find any. I was right back over by the vegetables when I saw a young-ish guy who was holding so many boxes of cooked meats I almost couldn’t see his face.

“Hey, I can see you’re busy and I’m sorry to bother you. I just have a quick question. Where can I find the chocolate suace” I said. “Go look over by the ice-creams or ask someone down there” he replied.

But there are no shelves down by the big freezers that are home to the ice-creams. “How could the chocolate sauce be there?” I thought. That busy shop assistant just wanted me gone and he’d given me duff advice. I was livid with him but I thought I’d better go and check the ice-cream aisle before demanding to see management and having this disgraceful young shop assistant publicly flogged and humiliated.


I entered the ice cream aisle from the centre lane, taking a left. At the far end of the aisle it looked like there was some kind of lunch trolley from a retirement home just standing there. It looked like it had some products on it.

It made me worry. Had I cracked under all of this pressure? Was I hallucinating in the frozen aisle?

Before those thoughts could escalate into a full-on psychosis, my gaze landed upon Viennetta. The magical Viennetta of which I had not had the pleasure for so many years. As I opened the fridge, and delicately reached into the precious Viennetta, the feeling brought me a few moments of sanity and calmness.

I put the Viennetta in my basket and decided to check out the abandoned trolley at the end of the aisle.

A stray bottle of shampoo, some syrup, some cheese crackers… AND 3 BOXES OF CHOCOLATE SAUCE! Get in there!

This was either the hidden treasure I desperately sought, or full-on psychosis had finally took residence within my fragile mind.

The Chocolate Sauce Heuristic for Software Design

There are a few lessons about software development we can learn from this story, but I want to focus on software design.

The designers of the supermarket had to decide where the chocolate sauce should live. It’s used for desserts — it could live with desserts. It is chocolate — it could live with chocolate products. It’s a sauce according to its name — it could live with sauces. It is eaten with squirty cream — it could live with cream.

As software architects, we have to make the same challenging choices. We want to create loosely-coupled systems enabling us to isolate, comprehend, and evolve independently, but there are many ways we can group concepts and define boundaries in our systems.

Importantly, we need to be aware that cohesion and co-change are not intrinsic technical characteristics of software design. They change over time. Different parts of your system will change together at different times based on your business requirements.

If we’re having breakfast, we might want chocolate sauce on our waffles. If we’re having dessert we might want chocolate sauce on our ice-cream. Yet if we were a shop specialising in only chocolate products, we would group chocolate sauce with other items comprised of chocolate.

You’re also probably noticing a higher-level concept. That things can be grouped on shared characteristics (e.g. chocolate) or how they are used together (e.g. with ice cream). You’ll see this fundamental modelling choice at almost every layer in a system. And there is no single best practice.

A Software Design Example

Consider the example of a marketplace for financial products. Customers use this product because it provides credit card deals, mortgages, and loans from all of the different providers conveniently in a single place.

If you naively modelled the domain, you might have a credit cards, loans, and mortgages context. They seem so obvious what other choices are there?

These are totally valid choices by the way, if you are working in this domain and you have these contexts, I’m not saying they’re wrong. Please read on for clarification. It’s the process you use to make the design decisions that matters.

But as you start to combine knowledge of the business model with the domain you realise that within each category of product, there is a consistent way of grouping them: Tier 1 products for people with a high credit rating, Tier 2 products for an average rating, and Tier 3 products to accommodate low credit ratings.

Now there are a couple of dimensions by which we can relate each concepts, and that means there are multiple ways of slicing the domain.

Do we group things that are used together by the same customers, e.g. Tier 1 products within a Tier 1 bounded context? Or do we group things that share the same characteristics, e.g. credit cards within a Credit Cards bounded context?

The answer depends on your business model, the levels of co-change and many other factors. If 95% of your revenue is from Tier 1 customers, you might want to create a Tier 1 context to ensure you can innovate quickly where ROI is greatest. Conversely, if 95% of revenue is through credit card deals, you might want to align with products.

However, if you are always making changes to all 3 contexts at the same time, you may want to reshape the boundaries to minimise dependencies to reduce the coordination overheads, even if that doesn’t align with the business model.

The domain expertise required in each context, the existing organisational structure, technical debt, the long-term business strategy, and hundreds of other factors can determine the optimal software design at any point in time.

So remember to always keep the chocolate sauce heuristic in mind:

Classification is multi-dimensional. Concepts relate to each other in multiple ways. Before committing to a software design choice, sketch out all of the possible ways of grouping a concept.

And of course, when you need to choose the most suitable design, The 5 Primary Heuristics of Sociotechnical Architecture will help you to identify the optimal solution for your business needs.

A big thanks to Zsofia Herendi who invented the chocolate sauce heuristic.

To read more about data architecture, click here.

Similiar Articles


Sign up today for monthly newsletters containing:

  • News and insights from your industry
  • Relevant thought leadership articles
  • Engaging video content
  • Notifications of our upcoming events
  • Networking opportunities with C-Suite leaders