Alternative approaches for the use of metrics to order programs by complexity
Abstract With many program complexity metrics available, it is difficult to rank programs by complexity: the different metrics can give different indications. There are two parts to this problem. First, because different metrics can measure the same program attribute, we need a method of evaluating a given program attribute based on the values of all metrics that measure this attribute. Second, because different metrics can measure distinct program attributes, we need a method of evaluating the overall program complexity based on the values of all program attributes. This article compares two methods of simultaneously detecting those aspects of software complexity measured by the Halstead metrics and the McCabe cyclomatic complexity number. The first method synthesizes a combined metric by weighting each Halstead metric to reflect program attributes measured by the cyclomatic complexity number. The second method uses principal components analysis. This method derives a relative complexity metric, which represents each complexity metric in proportion to the amount of unique variation that it contributes. A validation study establishes a useful statistical relationship between this relative complexity metric and faults for a military telecommunications development effort.