Every time I show the show off the wonderful reports that are automatically generated by Team Foundation Server, I usually get asked about the Code Churn report, and what Code Churn is. After months of giving a good, but unofficial definition, Dave Bost, on his blog, did the hard work and discovered a wonderful (but academic) whitepaper on the Code Churn technology used by Microsoft in VSTS. The PDF can be found at Microsoft Research. It’s called Use of Relative Code Churn Measures to Predict System Defect Density, by Nachiappan Nagappan; Thomas Ball. Here’s the abstract:
Software systems evolve over time due to changes in requirements, optimization of code, fixes for security and reliability bugs etc. Code churn, which measures the changes made to a component over a period of time, quantifies the extent of this change. We present a technique for early prediction of system defect density using a set of relative code churn measures that relate the amount of churn to other variables such as component size and the temporal extent of churn. Using statistical regression models, we show that while absolute measures of code churn are poor predictors of defect density, our set of relative measures of code churn is highly predictive of defect density. A case study performed on Windows Server 2003 indicates the validity of the relative code churn measures as early indicators of system defect density. Furthermore, our code churn metric suite is able to discriminate between fault and not fault-prone binaries with an accuracy of 89.0 percent.