← Notes

DAMP Principle

🌳 Evergreen
Created: Jan 19, 2025
Updated: Jan 19, 2025

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