korrents

korrents · piece

The Wrong Abstraction

Sandi Metz · 20 Jan 2016

Others here said this too

Duplication is cheaper than the wrong abstraction, so code should not be made reusable before there are real examples of what the reuse has to do.

duplication is far cheaper than the wrong abstraction

Also said by Casey Muratori

Read the piece on sandimetz.com ↗

4 korrents from this piece ↓

Sandi Metz did not write this page.

Every claim below was made in this piece, quoted word for word and numbered in the order the piece makes them, so you can read it there rather than take our word for it. The sentence above each quote is our reading of the claim, not their wording. Each quote was checked against a stored copy of the page at build time; where the two differ, the quote is the fact.

  1. duplication is far cheaper than the wrong abstraction
  2. Existing code exerts a powerful influence. Its very presence argues that it is both correct and necessary.
  3. If you find yourself passing parameters and adding conditional paths through shared code, the abstraction is incorrect.
  4. Once an abstraction is proved wrong the best strategy is to re-introduce duplication and let it show you what's right.

Keep reading

The other pieces are the ones whose claims are worded most like this one's. That measures language, not agreement: they may argue the opposite.