Part 2 · 2 chapters · ~12 min
Decomposition, Analogy and Working Backwards
Breaking problems into parts and measuring each, recognising problems you have already solved (joins, queues, caches, state machines), working backwards from goals and deadlines, solving special cases first, and inverting a problem.
4
Three moves on one problem
The three moves often work together: decomposition finds where the problem lives, analogy finds a known solution, and working backwards checks that the solution is enough.
DECOMPOSE, ANALOGISE, WORK BACKWARDS
three moves on one problem: a month-end reconciliation that runs 5.5 hours late
swipe the figure sideways, or tap expand for full screen
1/4
decompose
Split the job into phases and time each. Loading and writing are fast; matching takes almost all the time. The problem shrank to one phase.
split and measure each partthe problem shrinks to one part
5
A catalogue of known problems
| if the problem looks like | it is probably | known solutions |
|---|---|---|
| matching items from two lists | a join | hash join, sort-merge, an index |
| work arriving faster than it is processed | a queue | backpressure, more workers, shedding, batching |
| repeating the same expensive work | caching or memoisation | cache with invalidation, precomputation |
| an entity moving through stages with rules | a state machine | explicit states and transitions |
| things that must happen exactly once | idempotency | keys, unique constraints, dedupe |
| finding when something broke | search | bisection (git bisect, binary search over time or input) |