Definition
DRY, short for Don't Repeat Yourself, is one of the most cited principles from The Pragmatic Programmer. It states that every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
Crucially, DRY is about duplicated knowledge, not merely duplicated text. Two code blocks that look identical but encode unrelated decisions are not a DRY violation; two distant places that encode the same business rule are, even if they look nothing alike.
Why it matters
How it works
You eliminate duplication by giving each piece of knowledge one home and having everything else refer to it. A shared function, a single constant, a generated artifact, or a single source schema all serve this purpose.
The Pragmatic Programmer authors distinguish kinds of duplication: imposed, where the environment seems to force it; inadvertent, where developers do not realize they are duplicating; impatient, where copying feels faster; and interdeveloper, where teammates duplicate each other's work. Each kind has a different cure, but the goal is the same: name the knowledge once and make every other reference point back to that name.