Code Churn
What Is Code Churn?
Code churn is the share of recently written code that is rewritten or deleted shortly after it was written, typically within two to three weeks. It measures rework: effort spent changing code that was only just delivered. Some churn is normal, because developers iterate toward a solution.
Why Code Churn Matters
Churn is effort that produces no new functionality. If a quarter of the lines a team writes are replaced within three weeks, a quarter of its coding time went into doing the work twice. Sustained high churn usually traces back to unclear requirements, late design changes, or review feedback that arrives after the code is built.
How Code Churn Is Measured
code churn (%) = lines rewritten or deleted within the churn window / total lines changed × 100
The churn window is the age limit for "recent" code, most often 21 days. For example, a team changes 2,000 lines in a sprint. Of those, 300 lines modify or delete code that the same authors wrote in the previous three weeks. Code churn is 300 / 2,000 = 15%.
The unit is a percentage of changed lines per period, read per team or repository. The trend matters more than a single value: a prototype phase has high churn by nature, and a mature service should not.
Code Churn vs Refactoring
Both change existing code, and the difference is age. Churn rewrites code that was written days or weeks ago. Refactoring improves older, established code without changing its behavior. Refactoring is planned maintenance, while churn is unplanned rework.
How Oobeya Uses Code Churn
Oobeya classifies every code change into one of four work types: new work, refactor, help others and churn. A change counts as churn when the same author modifies code that is no older than the threshold, which defaults to 21 days and can be changed by administrators. The work-type breakdown is on the Git Analytics tab under Analytics > Coding, Review & Delivery and on each team scorecard in Team Health. Coding efficiency is the sum of new work, refactor and help others, so it falls as churn rises. The recurring high rework rate Symptom flags teams whose churn stays high over several periods.
Frequently Asked Questions
What is a normal code churn rate?
There is no fixed standard. Churn depends on the product phase and the type of work, so each team is best compared with its own history.
What causes high code churn?
The usual causes are unclear or changing requirements, missing design discussion before coding, large pull requests that get major review feedback, and unfamiliar code or technology.