4 ms·
That really depends. A single function is often easy to unDRY, but some abstractions, in particular when stateful objects, hierarchies or layering come into pla
by Aardappel 8y ago
That really depends. A single function is often easy to unDRY, but some abstractions, in particular when stateful objects, hierarchies or layering come into play, are incredibly hard to unDRY. Even just spotting that they can be unDRIED without side effects can be super hard, making it such that most people won't have the courage to do it. Now you are much more stuck with this code than any repeating code.
I'd claim that _on average_ DRY-ing is easier than unDRY-ing. This assumes the repeating code is intentionally kept simple and linear.
The absolute worst code is a mix of repeating code and half-assed abstractions, where the "perfect refactoring" would have to "move" or "redo" abstractions. This to me is even harder than DRY or unDRY.