DEV Community

Discussion on: DRY & the Wrong Abstraction

Collapse
 
paratron profile image
Christian Engel

Its a balance act (like most of the time). The drawback in getting DRY is that the code will have reduced flexibility. If parts of the application need to be refactored, that is much more work in a DRY application because you either need to extend the parts and need to be super careful not to affect other parts of the program. Or you need to break up again and create near-copies of some structures.

On the other hand, being DRY reduces the surface for bugs. More code = more surface for bugs, simple as that.

I think its a good rule of thumb to not trying to get into too DRY code too fast. Stay flexible until the overall architecture of some modules got settled and with refactoring and the use of unit tests it will be easier to DRY the code part by part.