I don’t buy “duplication is cheaper than the wrong abstraction” (2021)

In the Rails community, there is a saying that “duplication is cheaper than the wrong abstraction,” but the author of this post disagrees with this idea. They argue that creating new abstractions to eliminate duplication can lead to confusing and messy code. They agree that it’s important to avoid adding conditional logic to abstractions, as it undermines their purpose. However, they take issue with the concept of “the wrong abstraction,” seeing it as a confused way to refer to poorly-de-duplicated code. They also argue that duplication is not always cheaper, as its cost depends on the specific scenario and the quality of the alternative code. The author believes that duplication should be avoided and that addressing the underlying reasons for developers’ reluctance to refactor is a better solution than allowing duplication to persist. They emphasize the importance of fostering a culture of collective ownership and using risk-mitigating practices like automated testing.


To top