DEV Community

Discussion on: How to write a clean code.

Collapse
 
phantas0s profile image
Matthieu Cneude • Edited

The DRY principle is not about code duplication, but knowledge duplication. It's not the same thing at all. From the Pragmatic Programmer, the book which coined the term, DRY is defined as:

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

This makes a big difference I explain here.

Other than that, all these principles are nice and we should definitely know them, but always keep in mind that it depends on the context you're in. Don't apply them blindly, think before if it's wise to apply them.