Skip to content

DRY

Don't Repeat Yourself — a principle: each piece of knowledge should have a single representation in the system. Duplication is evil.

Why Duplication is Dangerous

Change logic in one place and forget about another. Copies diverge, and the code starts to behave differently.

How to Follow

Move repeating code into functions and modules. If a rule repeats, it is a candidate for refactoring.

See Also

← All Terms