R1.08.3rule of threedesign

Wait for three repetitions before abstracting — a heuristic, not a law

Aliases: wait for three · three repetitions · abstraction heuristic

What it is

One implementation has no comparison: duty and this-page accident cannot be told apart. Two similar sites can still be a coincidence. Three start to make “this is a pattern” a better bet than “this is luck”. The rule of three is that sampling intuition in slogan form: common, memorable, able to stop the first draft from landing in the library. It is a heuristic, not a law — sometimes two sites should already be abstracted (the structure is nailed down outside), sometimes five still should not (the five are still each page’s coincidence). It answers “when to start extracting”. It does not answer whether the extract will explode into parameters, and it does not claim that copies are always cheaper.

Treating “three” as a KPI is as mechanical as abstracting from the first draft.

Why it happens

Abstraction needs comparison. A single occurrence offers one shape; the cut is the author’s preference. Two offer a possible axis, but two points always make a line, and the points off the line have not arrived. Three give a pattern that can be falsified: if the third site will not fit the first two’s cut, the cut has to change, and the cost is still three local copies, not one public interface. The heuristic’s power is delay: delay lets the cut appear in repetition rather than in prediction. It does not say the fourth site will match. It says that under three samples you can barely tell pattern from coincidence, and a shared library punishes writing coincidence as contract. How the heuristic fails is also clear: treating three as a license, extracting the moment the third appears, without checking that the three share a duty — that is only premature abstraction postponed to occurrence three.

Where it stops holding

Structure already fixed by platform or law may be extracted at the second site; waiting for a third is ceremony. Short-lived repetition (three landing pages in one campaign) should not be extracted even at three, or a campaign skeleton becomes a long contract. “Three” copies emitted by one template generator are not independent samples; the count is invalid. Teams that have never paid a migration bill for a wrong abstraction hear bureaucracy; teams just burned by one raise “three” to “five” or “never”. Both deviations have to be walked back to failure modes: joints frozen early, or a shareable duty kept forked. The rule of three does not speak to “is the name too generic” or “are there too many layers in between” — those are a different kind of overdoing it.

Applying it

  • On the promotion checklist: how many independent production call sites? Below three, default is stay out of the library, with named exceptions (platform primitives, legal freeze) rather than a quiet “it looks similar”.
  • When counting, drop sibling copies: generated from one template, or duplicated from one page, count as one, not three.
  • At the third occurrence, try the existing cut first. If it fits, extract; if it does not, change the cut or keep them separate — do not warp the third into the first two’s interface.
  • Check: take last quarter’s promotions and mark independent call-site count at promotion time. Mostly under three with no platform or legal exception means the heuristic is idle. Mostly equal to three, but the third only fitted after a new parameter, means three was used as a license and the sampling intuition was wasted. Find two intentional non-extractions that already repeat: if a third never arrives or arrives and will not fit, the wait was right. If a third fits cleanly and the team is still maintaining three copies, the heuristic was promoted into dogma — extract. Whether copies themselves are cheaper is a different ledger; it is not settled inside this heuristic.

Related

  • Same group: R1.08.1 Abstracting too early freezes the wrong structure · R1.08.2 A component with too many parameters cannot be used correctly
  • Adjacent: R1.17 Over-abstraction of components · R1.02 Component libraries and variants
  • Search terms: rule of three · wait to abstract · repetition heuristic

Cards in the same group

Quick Actions

Share

Share this page

ios_share

https://hci.top/en/handbook/R1.08.3