Why is defect density risky to compare across teams or products?
Answer
Defect density normalizes defects found by a size measure such as KLOC, function points or module count, but the denominator is a modeling choice, not an objective fact; two teams can count size differently, and code volume does not equal functional complexity or risk. A team writing dense, well-tested business logic can show higher density than a team padding out boilerplate, without either number saying anything about actual quality. Use density inside one team's own trend over time, paired with severity and change context, rather than as a cross-team league table.
Strong answer includes
- names at least one size denominator and calls it a modeling choice
- explains that code volume is not the same as complexity or risk
- restricts valid use to within-team trend, not cross-team ranking
Practical example
Two teams report defect density per KLOC; the team with the 'better' (lower) density turns out to have three times more boilerplate-generated code inflating its KLOC denominator. Leadership stopped using cross-team density comparisons after the discrepancy was traced, keeping density only as a within-team trend metric.