Does code metrics predict software quality?

published Feb 18, 2016 06:50   by admin ( last modified Feb 18, 2016 06:53 )

To an extent, it seems it does. Microsoft has checked on a number of projects and found that these metrics do correlate with the quality of the software developed:

Precision is lack of false positives, i.e. 100% means it was right about all the projects pinpointed (but may have missed some)

Recall is lack of false negatives, i.e. 100% means it found all projects, but also potentially many that were false positives

Organizational structure and Code churn are different beasts than the other ones. They both are metrics of things that are to an extent inevitable. They cannot be designed away, at least not code churn. Organizational structure is about measuring turnover of people and if participants are from disparate organizations. That can be handled to some extent, but not in code.

The other four one can take a shot at, at the design level of the code.

Explanations from the paper of Code Churn Model and  Code  Complexity  Model:

Code Churn Model:

  • Total Churn: Total added, modified and deleted lines of code
  • Freq:  The  number  of  time  that  a  binary  was  edited during  its  development  cycle.
  • Repeat  Freq:  The  number  of  consecutive  edits performed  on  a  binary. 


Code  Complexity  Model:

  • (Max)(Total)  Cyclomatic  complexity
  • (Max)(Total) Fan-In: # of functions calling function
  • (Max)(Total) Fan-Out: # of functions called by function
  • (Max)(Total) Lines of Code (LOC)
  • (Max)(Total) Weighted methods per class (if any)
  • (Max)(Total) Depth of Inheritance (if any)
  • (Max)(Total) Coupling between objects (if any)
  • (Max)(Total) Number of sub classes (if any)
  • Total Global variables.

 

 

Microsoft Word - Org_Ver15_TechReport.doc - tr-2008-11.pdf