← Notes
DAMP Principle
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]].
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
Linked References
- [[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.