One real copy

Think of it when the same fact, such as a price or a rule, is written down in two places.

In everyday life

Like the one departure board in a train station. Staff may print copies, but when a train changes platform, the board is right and every printed copy is wrong.

One case

A shop runs a sale on a tote bag from Wednesday to Friday. The product page reads the price from the product table, so it shows $20. The checkout has the price hard-codedWritten directly into the code as a fixed value, instead of kept in settings or data., still $25. For three days, customers see $20 and are charged $25.

The page read the table; the checkout kept its own price
The case, cell by cell1 cell = 1 day
Price on the product page
$25$25$20$20$20$25
Price the checkout charges
$25$25$25$25$25$25
Days of wrong charges
3
Overcharge per bag
$5
The sale ran Wednesday to Friday. Only one of the two prices knew.

Every case

Every copy of a fact is one more place it can go wrong. Someone updates one copy and forgets the other, or never knew the other existed. Nothing crashes: each copy looks valid on its own, so the mismatch shows up as angry customers, not as errors. With one real copy, an update happens once and every reader sees it. Copies that must exist for speed are made from the source by a program, never by hand.

The word

Engineers call this

single source of truthEach fact lives in one place that everyone treats as the real one. Every other place reads it from there, or holds a copy made from it by a program, never edited by hand.

Give each fact one home. Make everything else read from it.

Where this idea leads

Skills that encode it

  • correct pstackGive each piece of state one owner, and replace hand-synced lists with one source of truth.
  • principle-laziness-protocol pstackConsolidate decisions: do not repeat the same choice in several places; put it behind one source of truth.
  • writing-for-agents Matt PocockKeep each meaning in a single source of truth, so a change is a one-place edit; a restated copy is a cache that can go stale.