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
problemmonth-end recon finishes 09:30part: load inputs12 minpart: match5 h 40 minpart: write breaks8 minanalogy"like a join without an index"backwards06:00 ← match must take < 2 h
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 likeit is probablyknown solutions
matching items from two listsa joinhash join, sort-merge, an index
work arriving faster than it is processeda queuebackpressure, more workers, shedding, batching
repeating the same expensive workcaching or memoisationcache with invalidation, precomputation
an entity moving through stages with rulesa state machineexplicit states and transitions
things that must happen exactly onceidempotencykeys, unique constraints, dedupe
finding when something brokesearchbisection (git bisect, binary search over time or input)