8 Measuring internal product attributes: structure


A. Törn - Contents - - Previous chapter - Next chapter - - Previous page - Next page

8.2 Other structural complexity measures

Bache has proposed a set of axioms to measure control flow complexity, and measures that preserve these axioms, theVINAP measures.

Adding control-flow lines to a listing of a program, the knot measure is defined as the number of control-flow lines that cross, see Figure 8.13.

Most of the measures proposed are scalar measures. It has been noted that there is no single metric that can be used to measure the inherent complexity of large software systems. It is expected that different metrix will be needed for estimating a program's readability, testability, maintainability, etc.

However, Törn et al  suggests that using composite mesures may help. The word complexity has several meanings in the empirical world. One meaning is is connected with size, i.e., a big system is considered more complex than a small one. Another meaning is connected with density, i.e., complexity is measured per size unit. Complexity density is the measure we have in mind when we find that system A is more complex than system B even if their sizes are equal.

McCabe's cyclomatic complexcity measure roughly counts the number of predicate nodes in a program. As the number of predicates normally can be expected to be proportional to the length of the program, McCabe's measure is a length type measure.

The two views of complexity could be naturally combined to give a composite measure (l,c), where l  and c  are the size and density component respectively. Analogously with mass, volume and density we may write

e(p) = l(p)c(p)

where p is some program unit and we let the size component be represented by a length measure l.