Software → Software Design
DRY
A design principle that discourages duplicating knowledge or logic across a system.
Motivation
DRY solves the problem of duplicated knowledge. If the same business rule exists in many places, a future change will eventually update one copy and forget another.
Where it fits
DRY belongs to software design. It relates to maintainability, refactoring, cohesion, and modularity.
Mental model
DRY does not mean “never repeat text.” It means each piece of knowledge should have one authoritative representation.
Example
If the rule “free shipping starts at 50 euros” appears in checkout, invoices, and marketing banners, it should become a named rule or configuration value instead of three independent literals.
Common mistakes
- Removing harmless duplication too early.
- Creating a shared abstraction before the repeated code is actually the same concept.