DEV Community

Discussion on: What conventional wisdom in software is wrong?

Collapse
 
katafrakt profile image
Paweł Świątkowski

That two similar-looking pieces of code must alway be abstracted out, because DRY.

Collapse
 
gypsydave5 profile image
David Wickes

The mistake here: people assume they need to DRY up repeated code. This is wrong. They need to DRY up repeated knowledge in the software.

Collapse
 
technoplato profile image
Michael Lustig - halfjew22@gmail.com

Seems profound here and like this could be highly useful. Could you maybe expand on how to identify the difference between knowledge and repeated code?

Collapse
 
kenbellows profile image
Ken Bellows

I usually do feel like I want to DRY things up once I hit 3 or 4 times though, at least if the block of code is at least like 10 lines long

Collapse
 
imdanwu profile image
Daniel Wu

I think a useful heuristic is 3. If you see the same thing implemented 3 times, it's worth considering, at least, if it's time to refactor and DRY it up