A team is tasked with 80% code coverage by quarter’s end. Six weeks later, the dashboard reads 82%, but tests assert nothing, and a production bug slips through. Everyone hit the target, yet it no longer shows whether the code works. This pattern is known as Goodhart's Law: when a measurement becomes a target, it stops reflecting what matters. This article explores the law’s origins, why it occurs, why software teams encounter it, and how to build resilient metrics. ## What is Goodhart's Law? In a 1975 paper on British monetary policy, economist Charles Goodhart wrote: "Any observed statistical regularity will tend to collapse once pressure is placed upon it for control purposes." Accordingly, targeted money-supply measures lost their predictive value. ([Wikipedia: Goodhart's law][wiki-goodhart]) The version most people quote came later. In 1997, anthropologist Marilyn Strathern wrote about British university audits: "When a measure becomes a target, it ceases to be a good measure.” ([Michael McIntyre, University of Cambridge][mcintyre-goodhart]) A metric is useful because it tracks something invisible, like code quality or customer value, until people are incentivized to improve it. Then they may raise the number without improving what it measures. ## Why the law exists: measures are proxies You measure what’s hard to observe. "Is this code well tested?" requires reading every test; "What's the coverage percentage?" takes one command. The percentage is a *proxy*: a cheap signal that usually tracks the harder-to-measure truth. Normal conditions are the catch: coverage correlates with test quality when engineers write tests to find bugs, making coverage a byproduct. But once coverage becomes the goal, engineers can raise it more cheaply by executing code without checking it. The correlation described behavior; the target changed it. A thermometer measures room warmth. If your bonus depends on a 22°C reading, holding a lighter under it is cheaper than fixing the furnace. The thermometer works perfectly; it just measures the lighter. ## How a metric decays under pressure The decay follows the same loop almost every time. ```mermaid flowchart TB A[A metric tracks a real goal] --> B[Leaders notice and set it as a target] B --> C[Rewards or scrutiny attach to the number] C --> D[People find cheaper ways to move the number] D --> E[The number improves while the goal stalls] E --> F[Leaders trust the number and push harder] F --> D ``` Leaders treat improved numbers as proof and push harder, rewarding the same shortcuts. Two details obscure this loop: the gaming is usually not malicious, and the dashboard looks great. Failures emerge elsewhere, in incidents, churn, or attrition, often months later. In *Measuring and Managing Performance in Organizations* (Dorset House, 1996), Robert Austin argued that people respond to measurement more cleverly than designers expect, so measurement-based management can undermine its intended results. He called this *measurement dysfunction*. ([Measuring and Managing Performance in Organizations][austin-book]) ## Goodhart's Law in software development Software teams produce many easy-to-count numbers, making them prime territory for the law. Robert Roskam’s [LinkedIn post on engineering metrics][roskam] and its discussion list familiar pitfalls that match many engineers’ experiences. * **Code coverage.** Coverage targets can raise coverage without improving bug detection: tests execute lines but don’t assert behavior. * **Story points and velocity.** When velocity is measured as performance, estimates inflate: a three-point story becomes a five, velocity rises, but nothing ships faster. * **Bug counts.** Rewarding low bug counts pushes bugs into chats and hallway conversations, or encourages workarounds instead of root-cause fixes. * **Deploy frequency.** Set a deployment quota and teams ship empty or trivial deploys to hit it. * **Lines of code.** Martin Fowler called productivity studies based on lines of code "one of my biggest irritations," since "any good developer knows that they can code the same stuff with huge variations in lines of code." ([Cannot Measure Productivity][fowler-productivity]) The [DORA team's guide to its delivery metrics][dora-guide] warns against setting metrics as goals, citing Goodhart's Law. It also cautions against "having one metric to rule them all" and comparing teams. Metrics belong at the application or service level: "the goal is to improve your team's performance over time, not to compete against other teams or organizations." AI speeds the feedback loop: a coding assistant can generate assertion-free tests faster than a person. Similarly, a model maximizing a reward may exploit flaws in its score rather than do the task. This is why AI safety researchers study Goodhart's Law. ([Manheim and Garrabrant][manheim]) ## Four ways a proxy breaks Broken metrics fail in different ways. David Manheim and Scott Garrabrant's 2018 paper [Categorizing Variants of Goodhart's Law][manheim] shows that "the measure stopped working” describes distinct mechanisms, each requiring a different fix. **Regressional** Metrics combine goals and noise, so extreme scores partly reflect noise. The lowest change failure rate this quarter may simply belong to the service with the quietest quarter. **Extremal** The metric tracked the goal within a normal range; pushing beyond it breaks the relationship. Raising coverage from 40% to 70% usually adds meaningful tests, while going from 95% to 100% often means testing getters and generated code. **Causal** The metric and goal share a cause, but changing the metric directly won’t change the goal. Good architecture enables frequent deployments; forcing them doesn’t improve architecture. **Adversarial** Someone with their own incentives optimizes the metric against you, whether gaming a bonus formula or exploiting a model’s reward function. The cards apply the paper's general categories to software. ## Related laws and ideas Goodhart wasn't alone; several related ideas belong in the same mental drawer. * **Campbell's Law.** In the 1970s, social scientist Donald Campbell made a similar point: "The more any quantitative social indicator is used for social decision-making, the more subject it will be to corruption pressures and the more apt it will be to distort and corrupt the social processes it is intended to monitor." ([Wikipedia: Campbell's law][wiki-campbell]) Writing in *Significance* in 2018, Jeffery Rodamar argues that Campbell's law dates to 1969. ([Wikipedia: Goodhart's law][wiki-goodhart]) * **The Lucas critique.** In 1976, economist Robert Lucas argued that historical relationships change when policy relies on them, a macroeconomic cousin of Goodhart's Law. ([Wikipedia: Goodhart's law][wiki-goodhart]) * **Perverse incentives.** A reward that backfires: Goodhart's Law describes when a measure becomes a target. * **Ridgway's dysfunctional consequences.** V. In 1956, V. F. Ridgway's “Dysfunctional Consequences of Performance Measurements" showed that single, multiple, and composite measures can harm organizational performance, nearly two decades before Goodhart's paper. ([Summary by James R. Martin][ridgway-summary]) ## Designing metrics that resist gaming You can't repeal the law, but you can make gaming expensive. Roskam's post identifies three traits of good engineering metrics: "there are multiple of them,” "they're in tension with each other," and "they measure teams or the organization," not individuals. ([Roskam][roskam]) Each blocks a different escape route. **Use several metrics.** One number can improve cheaply. Several rarely share an easy fix, so improving them all requires doing the real work. **Pair metrics that pull against each other.** Pair coverage with production defect escapes to expose inflated coverage without improvement. Pair deploy frequency with change failure rate to distinguish empty deploys from reckless ones. Pair mean time to detect with mean time to resolve to prevent teams from seeming fast by detecting problems late. **Measure teams and systems, not individuals.** Individual metrics invite gaming and penalize uncounted work like code review, mentoring, and unblocking teammates. Team metrics keep focus on the system. **Keep the number in a conversation.** Treat metrics as questions, not verdicts. Pair numbers with qualitative signals: engineers’ retrospectives, customer feedback, and on-call experience. **Watch for divergence.** If a metric improves but outcomes don't, it’s likely decoupled, the earliest warning of Goodhart's Law. ## Trade-offs and limitations Goodhart's Law cautions against targets, not measurement. Without metrics, teams rely on opinion and whoever argues loudest. Each countermeasure has costs: multiple competing metrics are harder to explain than one headline number; team-level measures can hide struggling individuals; and qualitative reviews take longer than dashboards. No metric is gaming-proof; enough pressure will eventually drive even determined optimizers to find a loophole. The law is strongest when stakes hinge on the number: a coverage report used for curiosity drifts slowly; one tied to promotions drifts fast. ## Common misconceptions **"Goodhart's Law means metrics are useless."** Metrics degrade when they become targets. Used only for diagnosis, without rewards tied to changing them, they remain linked to outcomes. Thus, the same coverage report can help one team and mean little to another. **"Gaming means people are cheating."** Most gaming follows instructions. The cheapest route to a metric rarely feels like cheating. Writing tests to raise coverage is rational; the target’s design is the problem. **"A better single metric will fix it."** Every metric has an easy path to improvement. Replace coverage with mutation score, and the same cycle resumes. Metric tension matters more than any single clever metric. **"Strathern's sentence is Goodhart's original."** Goodhart described statistical regularities collapsing under control pressure; Strathern coined the crisp "measure becomes a target" phrasing two decades later. ## Conclusion A metric’s value comes from linking a number to something you care about. Because targets shape behavior, Goodhart's Law occurs when the number improves but the underlying outcome stagnates or worsens. Treat every metric as gameable. Before rewarding it, identify the easiest way to game it, then make that costly by balancing several team-level metrics and treating them as questions, not verdicts. ## Next steps * Read [Fundamentals of Metrics][fundamentals-of-metrics] for how to choose and define metrics in the first place. * Read [Fundamentals of Empirical Software Engineering][fundamentals-of-empirical-engineering] for how to tell whether a change actually helped. * Read [What Is Continuous Improvement?][what-is-continuous-improvement] for how to keep metrics in a feedback loop instead of a scoreboard. * Read [What Is Software Delivery?][what-is-software-delivery] for context on the delivery metrics teams most often turn into targets. * Choose one metric your team reports, identify the cheapest way to improve it without improving outcomes, and name a second metric to expose the shortcut. ## References * [Goodhart's law][wiki-goodhart], Wikipedia, for Goodhart's 1975 wording, Strathern's 1997 phrasing, and the Campbell and Lucas connections. * [Goodhart's Law][mcintyre-goodhart], Michael E. McIntyre (University of Cambridge), for Goodhart's statement of the law and Strathern's restatement. * [Categorizing Variants of Goodhart's Law][manheim], David Manheim and Scott Garrabrant (2018), for the regressional, extremal, causal, and adversarial variants. * [DORA's software delivery performance metrics][dora-guide], Nathen Harvey, for DORA's warnings against using its metrics as goals or comparing teams. * [Cannot Measure Productivity][fowler-productivity], Martin Fowler (2003), on lines of code as a productivity measure. * [Robert Roskam on Goodhart's Law and engineering metrics][roskam], LinkedIn, for the software examples and the three properties of good metrics. * [Measuring and Managing Performance in Organizations][austin-book], Robert D. Austin (Dorset House, 1996), on measurement dysfunction in software organizations. * [Campbell's law][wiki-campbell], Wikipedia, for Donald Campbell's formulation. * [Summary of Ridgway (1956)][ridgway-summary], James R. Martin, for the dysfunctional consequences of performance measurements. [wiki-goodhart]: https://en.wikipedia.org/wiki/Goodhart%27s_law [mcintyre-goodhart]: https://www.damtp.cam.ac.uk/user/mem/papers/LHCE/goodhart.html [wiki-campbell]: https://en.wikipedia.org/wiki/Campbell%27s_law [manheim]: https://arxiv.org/abs/1803.04585 [dora-guide]: https://dora.dev/guides/dora-metrics-four-keys/ [fowler-productivity]: https://martinfowler.com/bliki/CannotMeasureProductivity.html [roskam]: https://www.linkedin.com/posts/robertroskam_i-wish-more-software-engineering-leaders-activity-7340498621840216064-BHwx [austin-book]: https://www.oreilly.com/library/view/measuring-and-managing/9780133488425/ [ridgway-summary]: https://maaw.info/ArticleSummaries/ArtSumRidgway56.htm [fundamentals-of-metrics]: https://jeffbailey.us/blog/2025/11/09/fundamentals-of-metrics/ [fundamentals-of-empirical-engineering]: https://jeffbailey.us/blog/2026/07/14/fundamentals-of-empirical-engineering/ [what-is-continuous-improvement]: https://jeffbailey.us/blog/2026/12/04/what-is-continuous-improvement/ [what-is-software-delivery]: https://jeffbailey.us/blog/2024/12/07/what-is-software-delivery/