Don't Repeat Yourself
Updated 2026-07-30
Summary
"Don't repeat yourself" (DRY) is a principle of software development aimed at reducing repetition of information which is likely to change, replacing it with abstractions that are less likely to change, or using data normalization which avoids redundancy in the first place. The DRY principle is stat…
Definition
"Don't repeat yourself." Every piece of knowledge or logic in a system should have a single, unambiguous, authoritative representation. If you write the same code in two places and change one but forget the other, bugs arise. Scaffold use: single point of truth. In company management, ensure the "Source of Truth" is unique. Do not maintain two different customer lists, and do not have two departments responsible for the same thing. Redundancy is the source of chaos.
Introduction
How to use
Single point of truth. In company management, ensure the "Source of Truth" is unique. Do not maintain two different customer lists, and do not have two departments responsible for the same thing. Redundancy is the source of chaos.
Mechanism
"Don't Repeat Yourself" — every piece of knowledge or logic in a system should have a **single, unambiguous, authoritative representation (Single Source of Truth)**. Repetition means that modifications require syncing multiple places, and any omission leads to inconsistency and bugs. The mechanism is to replace "copy/paste" with "abstraction/reference".
Practice
In progress 0/4Practice this model in one real situation:
Cases
- Two places with the same tax calculation logic; changing one but forgetting the other causes accounting errors — merging into a single function eliminates the risk. In organizations, also maintain only one master customer data.
Common pitfalls
- - Over-abstracting to "avoid repetition" can make code harder to understand and maintain (DRY is not about never writing a second line of code); - Forcibly merging things that are only coincidentally similar (not the same knowledge); - Ignoring the trade-off between "synchronization cost" and "understanding cost".
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- en.wikipedia.orghttps://en.wikipedia.org/wiki/Don%27t_repeat_yourselfverified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS