Problem Decomposition

The deepest module. Breaking a store into catalog, cart, checkout, orders and payments — then checkout into its steps — and telling a good decomposition from a technical one.

Decomposing a Problem
▶ lab

"Build an e-commerce platform" cannot be built; "list products", "add to cart" and "create an order" can. Decomposition is the move from the one to the other — and the split is judged by whether each piece could be built and checked on its own.

Q · A problem is too big to hold in your head at once. How do you split it so that every piece is something you could actually build and check, without the split itself being a week of diagrams?
Decomposition by Capability

Browse a product, add it to a cart, check out: a capability is something an actor can do, end to end, that you could demonstrate. Splitting a problem along capabilities gives every piece a test in the user's words and a natural order of work.

Q · What is the unit a problem should be split into, so that finishing a unit means something to the person who asked for the system?
Decomposition by Layer

Frontend, backend, database is a true statement about the solution and an empty one about the problem: it fits every application, so it distinguishes none. It is still the right split in a few specific situations — when the product is already known and one layer is the problem.

Q · When someone splits the problem into frontend, backend and database, what have they actually decided — and when is that the right split after all?
What Makes a Good Subproblem
▶ lab

A useful subproblem is understandable, testable, meaningful and small enough to build without further splitting. Most bad decompositions fail exactly one of the four, and naming which one tells you how to fix it.

Q · You have split the problem. How do you tell whether a piece is a real subproblem or just a heading with a confident name?
Recognising a Bad Decomposition

Layer-only, too wide, too deep, a single child, vague names: the five shapes a decomposition takes when it has stopped being about the problem. Each is visible in the tree's outline before any code is written.

Q · A decomposition can look complete and be useless. What are the shapes that give a bad one away, and what does each one mean you skipped?
Recursive Decomposition

A child that is still too big is decomposed the same way its parent was. Checkout becomes Load Cart, Validate Items, Calculate Total, Create Payment, Create Order, Confirmation — and the recursion stops where a leaf could be built on Monday and checked on Friday.

Q · Once a piece of the problem is still too big to build, how do you split it again — and how do you know when to stop splitting?
The Dependency Map
▶ lab

Checkout depends on Cart, Inventory, Payment and Orders — but not all in the same way. Some must answer before the customer can be told anything; some can be told later. Drawing the edges, and marking which kind each is, turns a tree into an order of work and a design for what happens when a dependency is slow.

Q · Which pieces of the decomposition need which others — and among those, which must be finished before you can respond to the user at all?
Decomposing Checkout
▶ lab

The whole module applied to one capability: checkout from a sentence to testable leaves, with the layer it crosses, the decisions the split surfaces, the dependency it cannot control, and the tool it did not need.

Q · Can you take the hardest capability in the store from "turn a cart into a paid order" all the way down to leaves you could build and check — without the decomposition becoming a design document?