DAMP Principle
Descriptive and Meaningful Phrases - a principle encouraging readability over uniqueness.
DAMP stands for “Descriptive and Meaningful Phrases” - a principle that encourages readability over uniqueness to make files easier to understand and maintain.
Core Idea
The DAMP principle prioritizes:
- Clarity and explicitness
- Easy comprehension at a glance
- Maintainability by humans and tools
- Descriptive, self-documenting code
When DAMP Works Better Than DRY
DAMP is particularly effective for:
- Configuration files: BUILD files, config files that aren’t tested like code
- Test code: Where each test should be independently understandable
- Tool-maintained code: Files that need to be parsed and modified by automated tools
Bazel’s Rationale
According to the Bazel BUILD Style Guide, BUILD files aren’t code, they are configurations. They aren’t tested like code, but do need to be maintained by people and tools. That makes DAMP better for them than [[DRY]].
The same logic explains the [[Nginx sites-available/sites-enabled split]] โ descriptive directory names doing the work of “is this active?”, so humans don’t have to read config bodies to find out.
Trade-offs
DAMP accepts some repetition in exchange for:
- Better discoverability
- Easier automated refactoring
- Clearer intent
- Reduced cognitive load
Related Concepts
- [[DRY Principle]] - Alternative approach for application code
- [[Source: Bazel BUILD Style Guide]]
- Code readability
- Configuration management
3 notes link here
- The Nginx sites-available/sites-enabled Split Is a Debian Convention Nginx loads what its include directives reference. The two-directory split for โฆ
- Bazel BUILD Style Guide Official Bazel style guide recommending DAMP over DRY for BUILD files.
- DRY Principle Don't Repeat Yourself - a principle encouraging uniqueness through abstraction.