Back to articles
Practical Notes on DRY: Why I'm Okay with a Little Duplication
How-ToDevOps

Practical Notes on DRY: Why I'm Okay with a Little Duplication

via Dev.toAsaduzzaman Pavel

I've lost count of how many PRs I've seen stalled because someone pointed out two similar-looking blocks of code and demanded they be "unified." It sounds like a great idea until you're three months deep into a "generic" validation function that now takes eight boolean flags just to handle one edge case in the billing service. ...And that's the trap. We're taught DRY like it's some kind of moral imperative, but in a microservice environment, "DRYing" your code usually just means you've built a hidden dependency that's going to make your next deployment a nightmare. I've lived through the "Shared Utils" era where changing a date formatter in one place broke the entire auth flow because someone thought it was "elegant" to share code between unrelated domains. The "Wrong Abstraction" is a Debt You Can't Refinance It is so much harder to "un-abstract" code than it is to just copy-paste five lines of logic. I once spent a whole Friday afternoon trying to decouple a GenericEmailService becau

Continue reading on Dev.to

Opens in a new tab

Read Full Article
2 views

Related Articles