DRY – Don’t Repeat Yourself

DRY - Don't Repeat Yourself.
Do not repeat what you already have.

Don’t Repeat Yourself (DRY)

  • Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
  • Don’t Repeat Yourself is software development principle helping to avoid repetition of the same information (same code produced multiple times). Having the same code in multiple places makes maintainability much harder, as the changes need to be done in all occurrences.
  • Achieving DRY can be done by dividing code into smaller pieces of functionality, which can be reused easily.
  • DRY violations are called WET (Write Everything Twice/ We Enjoy Typing).

DRY usage exmaples

The newest post: MVP Types