Why Measuring Lines of Code Is Worse Than Nothing
Lines of code as a productivity metric actively incentivizes bad behavior: less refactoring, no code reuse, padded code. Here's what to use.

A VP of Engineering at a Series C startup told me last year that he tracked "lines of code per developer per sprint." He said it with pride, like he'd cracked the productivity code.
That company lost four senior engineers in six months.
The developer productivity guide places line counts alongside the outcomes and working conditions a team should examine. Lines of code (LoC) is the cockroach of engineering metrics. It keeps coming back no matter how many times the industry kills it. So let me be unambiguous: measuring lines of code as a productivity indicator is worse than measuring nothing at all. At least "nothing" doesn't actively incentivize bad behavior.
The Obvious Problems
Let's start with what everyone already knows, then get to the stuff that actually ruins teams.
More code isn't better code. The best solution to a problem is often deleting code. I once refactored a 3,000-line module into 400 lines. The result was faster, more readable, and had fewer bugs. Under a LoC metric, I'd have a negative productivity score for the best work I did that quarter.
Languages vary wildly. Equivalent behavior can require different amounts of code in different languages. The line-count difference alone does not establish how productive either developer was.
Generated code inflates numbers. Run a scaffold command and you've "written" 2,000 lines in 30 seconds. Add a dependency and your lockfile gains 10,000 lines. Import a proto definition and auto-generate types. None of this is productive work.
The SPACE framework treats developer productivity as multidimensional. A line count supplies one activity signal, which needs the context of outcomes and the conditions of the work.[1]
The Real Damage: Incentive Corruption
When you measure lines of code, developers unconsciously (and sometimes consciously) change how they work. I've watched it happen at three different companies.
Developers stop refactoring. Refactoring changes internal structure while preserving external behavior. It can add or remove lines. If reducing lines hurts your metric, you stop doing it. Technical debt compounds. The technical debt metrics guide offers measures for investigating that cost. Six months later, the codebase is bloated, fragile, and slow. But everyone's LoC numbers look great.[2]
Developers avoid reuse. Writing a utility function that replaces 200 lines scattered across 15 files is one of the most valuable things a developer can do. Under LoC tracking, you just deleted 200 lines and added 20. Net negative. So developers copy-paste instead of abstracting. The codebase becomes a maze of duplicated logic.
Developers avoid code review. Time spent reviewing someone else's code produces zero lines of code. Under LoC metrics, reviews are pure cost. So developers rubber-stamp reviews to get back to "producing." Bugs ship. Quality drops. Incidents increase.
Developers pad code. I wish I were making this up. I've seen developers add unnecessary variable assignments, break one-liners into five lines, and write verbose comments that restate what the code already says. All to hit their LoC targets. This isn't malice. It's rational behavior in response to a broken incentive.
The Contrarian Take: Negative Lines Are the Real Signal
If you insist on looking at lines of code (and I'd rather you didn't), flip the metric. Track lines removed per sprint. Celebrate the developer who deletes the most code while maintaining functionality.
The best engineering work I've ever done was deleting things. Removing a dead feature that nobody used but everyone was afraid to touch. Replacing a hand-rolled caching layer with a well-tested library. Simplifying an over-engineered abstraction back to straightforward code.
A team where lines of code are going down while feature delivery stays constant is a team doing excellent engineering work. They're simplifying, abstracting, and paying down debt. A team where lines are going up faster than features is accumulating complexity.
The Stealable Framework: The Value Ratio
Instead of LoC, try what I call the Value Ratio. It takes five minutes to calculate and tells you more about productivity than any line count ever could.
Value Ratio = Customer-Facing Features Shipped / Total PRs Merged
Track this weekly. This divides a count of shipped features by a count of merged PRs. It is a descriptive ratio, and one feature can span several PRs. Interpret it with the work represented by the changes, including reliability, maintenance and internal tooling, before proposing any target.
This isn't perfect. No single metric is. Use it as one input to a discussion of delivery and the work needed to sustain it.
Combine it with PR size distribution (aim for a median under 200 lines changed) and review turnaround time (aim for under 4 hours). These three numbers together give you a healthier picture of team productivity than LoC ever could. The SPACE framework article adds the other dimensions to that discussion.
What to Do Instead
DORA defines change lead time from commit to production. Use that definition consistently when replacing a line-count target with a delivery measure. Google’s review guidance treats smallness as a judgment about a self-contained change and its spread across files.[3][4]
If you're currently tracking lines of code, here's your migration plan:
- Stop displaying LoC metrics immediately. Don't announce it. Just remove them from dashboards and reports.
- Track change lead time. Measure the time from commit to production deployment. This captures what you actually care about: how fast work flows through the system.
- Track PR size distribution. Not to measure productivity, but to encourage small, reviewable changes. Google’s engineering guidance recommends small, self-contained changes and says there is no fixed rule for how large is too large. Consider the files and behavior involved when choosing the review boundary.
- Ask your developers. Survey quarterly. "What slows you down the most?" The answers will surprise you. It's never "I don't write enough lines of code." It's usually meetings, unclear requirements, slow CI, or waiting for reviews.
The goal of measurement isn't to rank developers. It's to identify and remove friction. Lines of code measures neither friction nor value. It measures typing speed with extra steps.
Kill the metric. Your team will thank you.
Frequently asked questions
Can line counts still help an engineering team?
They can describe the size of a change or provide context for reviewing generated files and large diffs. Interpret that context with language, file type and behavior. Turning a raw count into an individual performance target can reward work that increases the count.
Is deleting more code a better productivity target?
Deletion can simplify a system when useful behavior is preserved. The count still needs context, including the affected requirements and tests. Review the reason for the deletion and its effect on maintainability before treating the line reduction as evidence of value.
Does the Value Ratio measure engineering effort?
Its numerator counts customer-facing features and its denominator counts merged pull requests. Those units form a descriptive ratio. A feature may span several pull requests, and a single pull request may represent substantial maintenance or reliability work.
Is there a fixed safe size for a pull request?
Google’s guidance favours small, self-contained changes and explicitly leaves room for reviewer judgment. Size depends on the spread across files, generated content and the behavior being changed. Use line counts to start a review discussion alongside that context.
Sources
- [1]The SPACE of Developer Productivity: There's more to it than you think - Microsoft Research · Microsoft Research
- [2]Refactoring Home Page · Martin Fowler
- [3]DORA | DORA’s software delivery performance metrics · DORA
- [4]Small CLs · Google Engineering Practices
Checked against these sources on





