Why Copy-Pasting Code Can Be Smarter Than Creating Abstractions Too Soon
Software developers are often taught to follow the DRY (Don't Repeat Yourself) principle, but engineering thinkers like Sandi Metz, Rob Pike, and Kent C. Dodds have argued that premature abstraction can cause more harm than duplication. Metz, in her 2014 RailsConf talk and a 2016 blog post, warned that a wrong abstraction becomes a tangled mess of flags and conditions that grows harder to remove over time. Pike echoed this in Go Proverbs, noting that a little copying is better than introducing an unnecessary dependency between unrelated code. A 2013 MIT PhD thesis by Daniel J. Sturtevant found that high code complexity reduced developer productivity by up to 50% and tripled bug density. The emerging consensus recommends tolerating duplication until a clear, natural pattern emerges across multiple iterations rather than abstracting at the first sign of similarity.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in