Code Churn
This metric tracks the number of changes made to code.
Main Description

Purpose

Code Churn measures the periodic (daily, weekly) count of change per source lines of code (SLOC) in order to forecast how difficult it may be to maintain and extend it.

Definition

Code Churn = Total SLOC added, removed or modified in a reporting period. Group churn by component for more fine-grained analysis.

Analysis

A good indication of when the time has arrived to assess the capability of a solution to continue to deliver the intended business service is the level of effort required to maintain and extend it. If it is becoming necessary to modify increasingly larger portions of the source code in order for it to continue to deliver value, this indicates that the time is approaching to consider modernizing the application.

If Code Churn is trending upwards instead of holding steady or declining, it is good practice to also analyze the impact of the modifications. If both the size and scope of the modifications are expanding into more involved architectural changes, this strengthens the case for considering a health assessment or similar review to determine whether it is time to consider new approaches such as re-implementing, re-engineering or re-architecting the solution

Frequency and reporting

Code Churn is best observed as a trend, captured from a successive series of packages over time.

Collection and reporting tools

Code Churn is captured in several ways. The most straightforward is by maintaining a running tally of number of changed SLOC per work item. The actual counts of changed SLOC's can be derived from the DIFF tool in IBM® Rational® ClearCase® and from the Compare Editor in IBM® Rational® Developer for System z®

Pitfalls, advice, and countermeasures

The citations below offer suggestions and advice for the significance of Code Churn as a component in determining an application modernization strategy. The key consideration is that it is important to be able to anticipate and plan for modernizing an application portfolio well in advance. Effective monitoring of code churn can help you see the problem before it becomes a crisis.

There have been many investigations into using code churn as a means to predict and characterize the state of complex software systems. A few citations are shown below:

J.C. Munson, S.G. Elbaum, "Code Churn: A Measure for Estimating the Impact of Code Change," icsm, pp.24, 14th IEEE International Conference on Software Maintenance (ICSM'98), 1998

Gregory A. Hall, John C. Munson, "Software evolution: code delta and code churn" Journal of Systems and Software Volume 54, Issue 2, 15 October 2000, Pages 111-118
Special Issue on Software Maintenance