DEV Community

Discussion on: The Art of Refactoring: 5 tips to Write Better Code

Collapse
 
patricktingen profile image
Patrick Tingen

Yes, I could, but this post from @xtrasmal does it best. The article that is linked to is well worth reading.

Just wanted to leave this here for people who are interested.

"DRY is about Knowledge, Code duplication is not the issue."
verraes.net/2014/08/dry-is-about-k...

In your example, I believe that when you encounter 16 copies of a snippet, it is fair to say that you did a good job of bringing them together. The point of the article linked is that you need to take good care in deciding if two identical pieces of code really /mean/ the same thing.