The wrong abstraction: why software engineers should prefer duplication over a premature abstraction

Software teams everywhere are taught the slogan: "DRY — Don't Repeat Yourself." For decades it was treated as the cornerstone of code quality. In a short 2016 blog post, Sandi Metz argued that the rule has been wildly mis-applied: the wrong abstraction is far more expensive than duplication. This week the essay returned to the top of Hacker News, drawing thousands of comments.
Metz is one of the best-known names in OO design and the Ruby community; her book Practical Object-Oriented Design in Ruby is standard course material. The Wrong Abstraction is only nine paragraphs long, but its endurance is worth examining.
Metz's thesis is plain. When you see similar patterns repeating in a codebase, it is tempting to immediately extract a common abstraction — a helper function, an abstract class, a generic interface. But this premature decision is risky: you do not yet know how the patterns will diverge in future. Over the years, the abstraction bends a little for each new caller, parameters accumulate, conditional logic creeps in — and the abstraction becomes far more complex than the problem it was originally trying to solve.
Her line: "Duplication is cheap. The wrong abstraction is very expensive to reverse." Because once the team has built around the wrong abstraction, undoing it means untangling every call site, finding the genuine seam, and rebuilding the code on the other side. That is many times more work than simple copy-paste.
Metz acknowledges that duplication feels scary to engineers: "Seeing the same 20 lines in three places, the voice in your head saying 'DRY this up' is normal. Resisting that instinct goes against the reflex our engineering training has reinforced." Her recommendation is to wait until the pattern has repeated three or four times before extracting. By then you can see which parts of the code are truly shared and which are context-specific.
In the microservice and API era, this matters more, not less. Every new shared library is a coupling between teams; over time that coupling becomes a substantial component of technical debt. Wikipedia editor and former Google engineer Hyrum Wright formalised the related principle now known as Hyrum's Law: "With a sufficient number of users of an API, all observable behaviours of the system — not just the ones stated in the contract — will be depended on by somebody." That is why the real-world cost of the wrong abstraction is so high.
Metz's essay regained currency in 2025-2026 because AI-assisted coding tools — GitHub Copilot, Claude Code, Cursor — can be very aggressive about pattern detection and abstraction suggestion. A commenter on Hacker News wrote: "Copilot is constantly suggesting that I 'DRY' three functions; the three functions still serve genuinely different domains. Premature consolidation is a much more common mistake in the AI era."
Metz's counter is that abstraction is the product of understanding the differences, not of recognising similarity: "Two things looking alike does not mean they should be abstracted. First map the dimensions on which they differ; only abstract once you can say 'all those differences will remain fixed in future.'" That sentence is one of the most-quoted pieces of software-engineering writing of the last decade.
The long-run view, in practice, is that undoing the wrong abstraction is often "half of technical debt". Former Stripe principal engineer Patrick McKenzie made a similar observation in a 2024 essay: "The most expensive engineering decisions of Stripe's early years were shared abstractions taken too early. Each one took six months on average to unpick."
The lasting reason Metz's essay endures is that it is language- and stack-agnostic. C++, Java, Python, Rust or TypeScript — Ruby or Go — does not matter. The wrong abstraction is a property not of the coding language but of the engineering decision itself. That is why a 2016 essay still hits a 2026 reader as freshly useful. One important nuance: Metz does not say "DRY is always wrong" or "duplication is always right". Her claim is that the real cost of an abstraction decision is much higher than most engineers estimate.
Read next

What is YOLO26? A practical introduction to the real-time object-detection model
YOLO26, the latest version in the YOLO family, has set a new reference point for the real-time computer-vision community. A comprehensive introduction from Roboflow covers the new architecture, ease of training and real-world applications in depth.

AI chipmaker Groq raises $650M and re-staffs: what Nvidia's $20B 'not-acqui-hire' deal means
AI inference chip specialist Groq has confirmed a $650 million funding round after losing part of its core engineering team to Nvidia. The deal structure highlights the semiconductor sector's new «not-acqui-hire» era.

AMD reinstates memory encryption in consumer CPUs after user backlash
AMD said it would reinstate transparent memory encryption on its latest Ryzen 9000 processors via a microcode update, after a campaign by security researchers and users. The decision could set up a race with Intel's comparable Total Memory Encryption feature.

What is the 2026 RAM crisis? Valve describes how brutal memory negotiations have become
Squeezed by AI data-centre demand, the global memory market is pushing up the cost of everything from game consoles to smartphones. Valve's account to Steam Machine manufacturers shows that bargaining for DRAM and NAND in 2026 feels «like a heist operation».

Tech layoffs in 2026 where employers cited AI: a running list of the biggest cuts
TechCrunch is maintaining a running list of major tech-sector layoffs in 2026 with a common stated reason: artificial intelligence. According to the data, 78,000 tech workers in the first six months of the year lost their jobs in the same week their employer announced AI-driven productivity gains.
