DEV Community

khalil la
khalil la

Posted on

3 1

DRY or not DRY?

What is DRY?

DRY (Don't repeat yourself) is a principle of software development aimed at reducing repetition of code.

How to Achieve DRY?

To avoid redundancy, DRY recommand replacing repetition with abstractions or using data normalization.

What is DRY Benefits?

Expectations

Less lines of code is less amount of bugs. It also saves time and effort and is easy to maintain.

Reality

"Duplication is far cheaper than the wrong abstraction." - Sandi Metz.
DRY at any cost isn't the right solution. Be aware of wrong code reuse. It's lead to a system too hard to maintain.

Thanks for reading

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay