Online Forum To Support Coders With Technical Assistance - Read Write Execute

What is DRY Code method in programming

Ankit Agrawal
Ankit Agrawal
Published on October 20, 2021 · 1 min read

DRY

DRY stands for DO NOT REPEAT YOURSELF. It’s a principle of software development to avoid and minimize repetition of code and reduce redundancy. This principle says that

“Every piece of knowledge should occur single time within the system.”

How to write DRY Code

  • Split your code into small pieces
  • Never write lengthy and bulky functions break them into small small functions
  • If you don’t need any logic in present please don’t write it in current situation this process is called YAGNI ( You aren’t gonna need it ) method

Benefits of DRY Code

  • Code will be clean and easy to understand
  • Dry code make your code robust
  • It’s minimize the errors
  • It will make your application faster
  • Code become more reusable
  • Save your time to debug application

 

Was this article helpful?
Ankit Agrawal

Ankit Agrawal

Author & Senior Engineer at CodeExecute

Writing practical engineering guides, debugging real-world bottlenecks, and creating free tools for developer productivity.

← Previous Article How to check git repository’s origin remote url at localhost Next Article → What are the falsy values in Javascript