DEV Community

loading...

DRY or not DRY?

khalil la
I am a full stack developer
・1 min read

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

Discussion (0)