Don't Repeat Yourself

Don't Repeat Yourself (DRY) is a key software design principle that mainly states;
- Every piece of knowledge must have a single, unambiguous, authoritative representation within a system. (The Pragmatic Programmer)
- Meaning simply that; do not duplicate the code written for the same business logic within a system.

What are the drawbacks of DRY violations ?
- If we repeate the same code within a system, maintaining the code when any logic changes will be difficult.
Because the change will have to be reflected to all portions of the code having the changed logic.

And the solution is ?
To avoid DRY violations, business logic should be seperated into smaller and reusable units and these units should be reused via calling them wherever possible.

Yorumlar

Popular

Java 14 New Features

Pretenders, Contenders and Liars

Java 12 New Features