Posted on 28 Aug 2024
software-engineering design-patterns
DRY aka "Don't Repeat Yourself" was first coined in the book Pragmatic Programmer by Andrew Hunt and David Thomas. Here is the snippet from the book explaining the principle:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
Why do we call it DRY?
DRY—Don't Repeat Yourself
"Don't Repeat Yourself" is just a short and punchy statement so it sticks around in the head. The principle is based on three clear callouts: Single, Unambiguous, and Authoritative.
DAMP aka "Descriptive And Meaningful Phrases", was coined by Jay Fields. He published a blog post comparing the two approaches and proposing that DAMP is required in scenarios where you are working with DSL. I want to widen the lens here a bit and propose that they are complimentary. DAMP emphasises being descriptive and meaningful, so does DRY on being unambiguous. Focusing on the intent they both want the intent of the outcome clear and self-explanatory.