When it comes to programming, modeling, and spec writing - don’t repeat yourself.

When at all possible - keep your code, models, and specifications DRY. That is to say, don’t write the same things over and over. Don’t repeat yourself. Don’t repeat yourself.

This is a best practice because it consolidates logic into a single source of truth.

Benefits of DRY code/docs include:

  • Propagation of changes by reference
  • Fewer hours spent copy/pasting during refactoring efforts
  • Fewer error traps

Caveats/Drawbacks of DRY code:

  • Sometimes repeating yourself is easier to do and easier to understand
  • Lists of references & pointers that don’t actually pull the content (or at least a summary thereof) are effectively useless by themselves and put the work on the reader (in the case of documentation)
  • It requires foresight or early-on refactoring

Source