Rule of Three
Two occurrences may be coincidence; at the third, similarity becomes a pattern — and a moment to consolidate.
The rule of three is a refactoring heuristic: you leave the first duplication alone, and the second as well — only at the third occurrence of the same kind do you consolidate. The reason is twofold: two places don't yet reliably show what is truly shared, so an early abstraction would often be the wrong one; three places make the common shape visible. The rule is therefore not a license to copy but its opposite: it names the moment when copying should stop and consolidating should begin — deliberately rather than by reflex.
Continue your engineering journey.
Related concepts, decisions, playbooks and perspectives — as one connected path, not a list of links.
Guides
Perspectives
From theory to production.
We apply these concepts in real systems — and keep running them for years.
