Also known as: DRY, KISS, YAGNI
DRY, KISS and YAGNI are three of software’s most-quoted design heuristics — short slogans that pack hard-won judgement about keeping code lean, simple, and free of speculative complexity.
The three heuristics
- DRY — Don’t Repeat Yourself. Every piece of knowledge should have a single, authoritative home.1 If a rule or constant appears in five places, a change means editing all five — and missing one is a bug. The crucial nuance: DRY is about knowledge, not characters. Two snippets that look alike but encode different facts are not a violation, and merging them creates the “wrong abstraction,” which Sandi Metz noted is far costlier than duplication.1
- KISS — Keep It Simple. The simplest design that solves the actual problem is almost always best. Complexity is a cost you pay forever in comprehension and bugs. Match the complexity of the solution to the complexity of the problem, and not a notch more.
- YAGNI — You Aren’t Gonna Need It. Build things when you actually need them, not when you merely foresee needing them. Speculative machinery for an imagined future is usually dead weight — extra code to read, test, and maintain, often guessing wrong.
Why they matter
The three reinforce each other and a fourth idea, separation of concerns: skipping speculative features (YAGNI) keeps today’s design simple (KISS), and clean seams between responsibilities let you deduplicate (DRY) correctly. They are the everyday antidote to over-engineering and the foundation beneath SOLID, clean code, and disciplined refactoring. Like all heuristics they are guidelines, not laws — the skill is knowing when not to apply them, such as resisting a premature abstraction on the first duplication.
Sources
-
Don’t repeat yourself — Wikipedia, for the DRY principle and the related KISS and YAGNI heuristics. ↩ ↩2