Code Complexity

Following code churn, we analyzed code complexity. That is, how does the complexity of a piece of code influence the ability to predict failures? Complexity can be quantified using several metrics, more suited toward object-oriented and non-object-oriented metrics ranging from the more traditional metrics such as fan-in and fan-out to the more recent CK metrics [Chidamber and Kemerer 1994]. The CK metric suite consists of six metrics (designed primarily as object-oriented design measures): weighted methods per class (WMC), coupling between objects (CBO), depth of inheritance (DIT), number of children (NOC), response for a class (RFC), and lack of cohesion among methods (LCOM). The typical object-oriented and non-object-oriented complexity metrics used at Microsoft based on prior published metrics (for example, [Chidamber and Kemerer 1994]) are:

Lines

Executable noncommented lines of code.

Cyclomatic complexity

The Cyclomatic complexity metric [McCabe 1976] measures the number of linearly independent paths through a program unit.

Fan-in

Fan-in is the number of other functions calling a given function in a module.

Fan-out

Fan-out is the number of other functions being called from a given function in a module.

Methods

Number of methods in a class, including public, private, and protected methods.

Inheritance depth

Inheritance depth is the maximum depth of inheritance for a given class.

Coupling

This signifies coupling to other classes through (a) class member variables, (b) function ...

Get Making Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.