This page is part of my personal knowledge database, that helps me to store and navigate my learnings.
Read on here for details

DRY

DRY, short for Don’t Repeat Yourself, is the principle that demands that no code duplications exists. More broadly:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system

The reason for that is simple:

  1. More code requires more maintenance. That is bad.
  2. More code is more surface for bugs. That is bad.
  3. Duplication invites divergence, inconsistencies. That is bad.

As a result, DRY implies modularization of code, into re-usable components. It also implies the use of constants (instead of repeated, same literals), externalized configuration (instead of inline) and even abstraction (as a means to generalize use).

Sources