DRY – Don’t Repeat Yourself

Don't Repeat Yourself is principle helping to avoid repetition of the same information (same code produced multiple times).
Read more
Article

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