What is DRY Code method in programming

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