Why Lines of Code Are A Bad Measure of Developer Productivity
What LOC and SLOC counts measure, why they cannot rank developer productivity, and how to use code size with delivery, quality and developer feedback.
On this page
Lines of code measure code size under a chosen counting convention. They do not tell you how difficult a problem was, whether a change helped users or how much work went into understanding it. Using that count to rank developers confuses the amount of source text with the contribution behind it.
Code volume can still help with review planning and repository analysis. The useful distinction is between describing a change and judging the person who made it.
What Are Lines of Code (LOC)?
LOC means lines of code; SLOC commonly means source lines of code. Neither abbreviation tells you exactly how a tool counts. Record the convention before comparing two numbers.
- Physical counts follow source lines. Tools may report code, comments and blank lines separately. For example, cloc's documentation describes separate counts for blank lines, comment lines and physical source-code lines. Its code column is not the total of every line in a file.
- Logical counts follow language constructs, such as statements, under the counter's rules. A statement can occupy several physical lines, and one physical line can contain several statements. SLOC is not a universal synonym for logical LOC.
- Repository totals and change totals answer different questions. A current codebase size is different from lines added, deleted or changed during a period. Net growth can hide substantial replacement work.
Keep the counter version, included languages and file exclusions with the result. Decide how to handle generated code, dependencies, tests and notebooks. A change in those rules can move the count without a corresponding change in engineering work.
For a shorter definition, see the lines-of-code glossary entry.
Language and Formatting Change the Count
Language syntax, libraries, generators and formatting all influence how many source lines express a behavior. A physical count can change even within the same language.
These two JavaScript snippets both print the number 3:
const total = 1 + 2; console.log(total);
const total = 1 + 2;
console.log(total);
The first occupies one nonblank source line; the second occupies two. Both contain the same two statements. The formatting change does not establish a difference in problem-solving effort, correctness or user value.
Cross-language rankings add more differences: the available libraries, language constructs and generated scaffolding may vary. Use code size to understand a repository's structure and changes, with the counting rules visible. It cannot supply a common unit of individual productivity by itself.
More Code Does Not Establish More Value
A useful change may add code, remove code or change very little code. A larger implementation can be appropriate, while a shorter one can hide difficult logic. Inspect the behavior and maintenance burden rather than assuming either direction is better.
Consider three hypothetical changes:
Scroll horizontally if needed →
| Change | What a line count shows | What a reviewer still needs to know |
|---|---|---|
| Regenerate an API client | Many added lines | Whether the schema change and generated output are correct |
| Remove an unused implementation | More deletions than additions | Whether callers, tests and rollback needs were checked |
| Fix a condition in a critical path | Very few changed lines | Whether the root cause is understood and the regression is covered |
These are examples of different work, not a productivity ranking. The counts cannot tell you which contribution mattered most.
The SPACE research explains why activity alone cannot describe developer productivity. Mentoring, collaboration and improving engineering systems can help the team without appearing as a large authored diff.
A Code Quota Changes the Incentive
If a performance target rewards added lines, developers have a reason to preserve or increase the count. That can conflict with simplifying a design, removing duplication or solving a problem through an existing capability.
This is a risk in how the measure is used, not evidence that every developer will game it. The SPACE authors recommend using several dimensions of productivity and avoiding isolated activity measures as a basis for rewards or penalties.
Keep diagnostic questions separate from quotas. A large PR can prompt a discussion about review scope; it should not automatically earn a higher performance rating. A small diff may deserve extensive investigation and testing.
Where LOC Is Useful
Code size helps describe review scope, repository growth and the scale of a migration. It can also provide a denominator for another measure, provided the language, included files and counting rules remain consistent.
Start with a decision the team can act on:
- A PR grew sharply: inspect generated files, unrelated changes and whether reviewers can understand the change.
- A repository total changed: check a planned migration, dependency import or file exclusion before treating it as an engineering trend.
- The same module changes repeatedly: inspect its history, tests and responsibilities alongside its size.
Our guide to code quality metrics that reveal technical debt covers complexity, code smells and churn in more detail. LOC can help interpret those signals; none alone proves that a module is defective.
What to Measure Alongside Code Volume
Match the evidence to the question. For delivery, inspect whether changes reach production safely and where work waits. DORA's current guidance uses five delivery measures and recommends interpreting them in the context of an application or service.
For a broader view, SPACE includes satisfaction and well-being, performance, activity, communication and collaboration, and efficiency and flow. Ask developers where they lose time and which work a repository report misses. Combine that feedback with review, reliability and product-outcome evidence.
When assessing AI coding tools, keep usage, output, quality and cost distinct. A rise in AI-generated lines shows a change in measured code volume. It does not establish that the team delivered more useful work or that AI caused a financial return.
How Weave Measures Engineering Work
Weave Code Intelligence analyzes PRs using estimated expert hours. Its AI ROI methodology describes how Silk 1 considers intent, complexity, risk and dependencies across files, with reasoning for the estimate.
That provides a modeled work unit for comparing code changes. It is not a timesheet, payroll savings or a direct valuation of customer benefit. Review the estimate alongside review activity, reverts, code turnover and delivery signals.
Weave also brings supported AI usage and cost sources into that view. Confirm integration coverage and the distinction between native, commit-based and activity-based attribution. Use those records to investigate the relationship between AI use and work produced.
To evaluate that approach on your team's work, book a demo or get started with Weave.
See the work behind your AI spend
Compare code output, AI cost and quality, then inspect the work behind the trend.