The reason a bonus for lines of code produces long code
Measure what you want and you will get exactly that — the metric, not the quality the metric was supposed to represent.
Filed by The Archivist 2 min read
Intuition test — answer before you read on
A company rewards developers for lines of code written. Output rises but code quality falls. What law describes this?
Correct answer: B
Goodhart’s Law predicts that the incentive will optimise the metric at the expense of the underlying goal. The developers are not cheating; they are rationally responding to the reward function. The metric rises because it has been targeted, and in being targeted it has stopped measuring what it was meant to measure.
A software company introduces a productivity bonus tied to lines of code written per week. Within a month, developers are writing more lines. They are also copying functions, splitting single operations into multiple steps and avoiding reusable libraries. The codebase grows. Its quality shrinks. The metric is rising while the thing it was meant to measure is falling.
What everyone sees
Managers see the rising line count and interpret it as increased output. The metric was chosen because it is easy to measure, and because more code feels like more work. The alternative — measuring code quality, maintainability or bug rate — is harder to quantify, so the easy metric fills the governance vacuum. Nobody asks whether the metric and the goal have diverged, because the metric is the only thing being reported.
What is actually happening
Goodhart’s Law states that when a measure becomes a target, it ceases to be a good measure. Campbell’s Law adds that the more a quantitative indicator is used for decision-making, the more it will be subject to corruption pressures and the more apt it will be to distort the process it is intended to monitor. The mechanism is not sabotage; it is rational optimisation against the reward function. Developers writing long code are doing exactly what the incentive tells them to do.
Why it stays hidden
The distortion hides because the metric looks healthy. Dashboards show output rising, and rising output is the story that dashboards are built to tell. The deterioration in code quality is invisible to the metric, so it is invisible to anyone who governs by metric. By the time the consequences appear — more bugs, slower releases, higher maintenance cost — they are attributed to technical debt or team changes, not to the incentive that created them.
Reward defines the output. The metric does not fail because people cheat; it fails because people succeed at optimising exactly what was measured.
Reward defines the output. The metric does not fail because people cheat; it fails because people succeed at optimising exactly what was measured.
Collect this card
Reward defines the output. The metric does not fail because people cheat; it fails because people succeed at optimising exactly what was measured.
0 / 10,000 collected
Sources & further reading 3
- Goodhart, "Problems of Monetary Management: The U.K. Experience", Papers in Monetary Economics, Reserve Bank of Australia, 1975
- Campbell, "Assessing the Impact of Planned Social Change", Evaluation and Program Planning, 1979
- Strathern, "Improving Ratings: Audit in the British University System", European Review, 1997
Cross-references
Related files
Filed near this one in the index.
-
No visual on fileStatistical Illusions Entry #0437
The reason a study that replicates is worth two that do not
A single study is a claim. A replication is a test of that claim. Two unreplicated studies are two untested claims, not twice the evidence.
AdeptThe hidden part #0437Novelty fills journals. Replication fills knowledge. The incentive structure rewards the wrong one.
Statistics Open file -
No visual on fileStatistical Illusions Entry #0434
Why a percentage change needs its starting point
A fifty per cent increase from two is one. A fifty per cent increase from two million is one million. The percentage is identical; the meaning is not.
AdeptThe hidden part #0434A percentage without a base is not a statistic. It is a frame looking for a denominator the reader will supply.
Statistics Open file -
No visual on fileScarcity & Queues Entry #0462
The reason an invitation raises acceptance more than an offer
An offer says the item is available. An invitation says the recipient was selected. The difference is not in the item but in the identity it assigns.
AdeptThe hidden part #0462An offer presents a product. An invitation presents an identity. People accept identities faster than products.
Scarcity Open file -
No visual on fileScarcity & Queues Entry #0458
The reason an expiring discount beats a larger permanent one
A permanent reduction can be acted on at any time, which means it can be postponed indefinitely. A deadline converts an intention into a dated task.
AdeptThe hidden part #0458An open offer can be postponed forever. The deadline is not pressure; it is the thing that gives the intention a date.
Scarcity Open file
Annotations are reserved for archive members.
Sign in to annotate