A1.02 · Pragmatic, revisited · dive 1
The single source of truth
DRY was never about typing; it was about knowledge. Every fact should have one authoritative home — so a change happens in one place and reaches every reader at once.
When an agent generates code, duplication becomes free to produce and the same price to reconcile. So DRY inverts: from a typing convenience into the discipline that keeps a fact from drifting. Move the slider, then change the fact, and watch the copies fall out of agreement.
One fact, many copies · change it and watch
What DRY actually says
DRY — Don't Repeat Yourself — is misremembered as a rule against typing the same lines twice. Its real claim is about knowledge: every piece of knowledge has a single, authoritative, unambiguous representation in the system. The enemy is not a repeated line; it is a repeated fact, restated in places that can disagree.
The fix is a single source of truth: one representation every reader derives from, so a change happens in exactly one place and reaches every reader at once. When a fact lives in many places instead, the copies form a drift surface — the set of sites that can fall out of agreement when a change reaches some and not others.
- DRY
- Every piece of knowledge has one authoritative, unambiguous representation in the system (Hunt & Thomas).
- single source of truth
- The one representation every reader derives from — change it once, and every reader sees the new truth.
- drift
- When copies of one fact stop agreeing, because a change reached some of them and not the others.
- drift surface
- The number of sites that can drift: for a fact in k places, that is k − 1.
The agent-era inversion in one line: generation makes the k−1 duplicate copies free to create, and changes nothing about the cost of reconciling them later. That cost is yours, not the agent's.
The two costs of a duplicated fact
A fact restated in many places carries two bills. The first is a correctness bill — a surface that can drift. The second is a maintenance bill — the work and the uncertainty of changing the fact later. An agent makes the copies cheap to produce; it does not pay either bill.
1 · The drift surface
A fact in k places has k−1 sites that can fall out of agreement. With one source there is nothing to keep in sync; with eight copies there are seven ways for the truth to splinter. The hero figure above is exactly this: change the fact at the source, and every duplicate that was not updated is now a stale site — quietly wrong.
2 · The reconciliation bill
Changing the fact means editing every copy of it. The more copies, the more edits — and the lower the confidence that all of them were found and updated consistently. Each extra duplicate is one more chance to miss one. Step the slider below: the bill is the edit count, and the confidence that the system stays consistent after a change falls as the copies multiply.
The reconciliation bill · move the slider
Duplication is no longer a typing cost the agent saves you; it is a drift surface the agent creates for free — and the reconciliation bill lands on the human who owns the system.
One authority on the Portal
Take one fact on the Portal — the learning platform this course builds. The branded id format,
“a 14-character TSK… id that decodes to a type”, is a single
piece of knowledge. It must have one home: the Portal.ID module. The store, the
Telegram bot, and the student dashboard all call Portal.ID; none re-derives the
format.
Ask an agent for “an id” in three surfaces and it will re-derive “14 characters” three times. Change the format later — to fifteen — and the two surfaces it was not pointed at break in silence. The repair is not cleverness; it is naming the authority and pointing the agent at it.
# Duplicated knowledge: the literal "14" restated in three surfaces. # Change the format and every forgotten copy is a stale, silent bug. if byte_size(id) == 14, do: store_user(id) # store/ if byte_size(id) == 14, do: reply(id) # bot/ (a copy) if byte_size(id) == 14, do: render(id) # dashboard/ (a copy) # One authority: the format lives once, in Portal.ID. Everyone derives from it. id = Portal.ID.generate(:user) # => "USR0NbAb1xcFCy" if Portal.ID.valid?(id), do: store_user(id) # the rule has one home
The illustrative ids and helpers follow the Portal's established
branded-id convention (Portal.ID.generate/1, decode/1),
taught in the companion Functional Programming in Elixir course.
The principle
Every piece of knowledge has one authoritative representation. Change it in one place; every reader sees the new truth at once.
On the Portal
The id format lives once, in Portal.ID. Every surface calls it; none re-derives
it — so a format change reaches all of them, with nothing left behind to drift.
One authority is the only price that does not grow: it costs the same whether one surface reads the fact or fifty.
Recap — where the fact lives
DRY is not a typing rule; it is a knowledge rule, and the agent era sharpens it. Generation makes duplicates free to produce and unchanged to reconcile, so the only stable answer is one authoritative home for each fact, with the agent pointed at it rather than asked to re-derive it. That is the first of three re-weighted principles — knowledge has a home; next, a unit gets a precise specification.
Next in A1.02: A1.02.2 · Design by contract — the precise pre/post/invariant triple that an agent implements against and you accept against.
References
Primary sources for DRY and the single source of truth, and where it connects in the course.
Sources
- Hunt & Thomas — The Pragmatic Programmer — “DRY — The Evils of Duplication” and the single source of truth.
- Parnas, D.L. — On the Criteria To Be Used in Decomposing Systems into Modules — one place for one decision (CACM, 1972).
- Anthropic — Building effective agents — pointing the agent at authoritative context, not re-derivation.
Related in this course
- A1.02 · Pragmatic Programming, revisited — the module hub.
- A1.02.2 · Design by contract — the next dive.
- A1.02.3 · Orthogonality and blast radius
- A1.01.1 · Vibe coding — compounding entropy, the drift this answers.
- A1 · Why an agile agent workflow