Don’t Repeat Yourself

Leave a comment

Don’t Repeat Yourself (DRY) is a software development principle that prevents waste through the repetition of code. When code is designed and developed, it should be abstract. As a result of abstraction, the code is easier to maintain and extend. Smarter code leads to less code waste, which leads to better software. Imagine if you find a bug in one part of your code, and the bug is repeated in many different places because the code was not implemented with the DRY principle. In this case, you would need to change the code in many different places to fix the bug.

However, the implementation of the principle is based on the situation. There are times when violating the DRY principle makes sense. These situations may include:

  • Performance. In some cases, abstraction may actually slow down your code
  • Understanding the code. You may have complex business logic that is easier to implement without abstracting the code. In this case, you may save time and effort maintaining the code going forward if you violate DRY
  • Ability to change the code later. You may not need the code abstracted in the future

The failure to implement DRY is often referred to as WET.

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *