ITWissen.info - Tech know how online

McCabe

For the measurement of software products so-called software metrics are used, which quantify different characteristics of software products and processes. The metric of McCabe was already presented 1976 by Thomas J. McCabe and is to be classified into the framework of the software metrics, with which a measure for the complexity of software can be determined.

The basic idea proceeds thereby from analyzing a software on basis of its logical structure. The advantage of this metric lies in its clearly more trivial computation - in contrast to the also frequently used procedures after Halstead and computing mountain. Particularly disadvantageous at the procedure after McCabe is however that this considers only the architecture of a program, but does not include however the individual instructions and expressions in their complexity as for example nesting depths of loops or the influence of long sequences into the evaluation. Also therefore the metric of McCabe among other things finds use in the determination of test and maintenance expenditures, whereby by the measure under assumption of the at least unique run of each path the minimum number of test cases is determined. The metric is also frequently used in the specification of structural constraints for software products to be developed.

On the basis of McCabe numerous further software metrics developed - among other things the static object-oriented software metrics.

Control flow graphs after McCabe

Control flow graphs after McCabe

McCabe proceeds from the thought to represent the logical structure of a software as a directed graph. Thereby instructions are represented as nodes of this graph, and its edges show the control flow between the instructions. Accordingly, the program complexity depends on the number of main paths, these are also called linearly independent program paths- in the graph created in this way - also called control flow graph. The minimum number of edge paths V necessary without overlaps to be able to map all edge paths by combinations is expressed by the following mathematical relation and called cyclomatic number:

V(g) = e - n + 2xp

Where e and n denote the number of nodes and edges of the graph, respectively, and p expresses the number of connectivity components. These are independent subgraphs, which in turn represent procedures or methods, for example.

The simplest case is that a program has only one input and one output. Then the measure of McCabe is determined to:

V(g) = 1 + number of binary branches.

Example sequence: V(g) = 1 - 2 + 2 = 1

Example Selection: V(g) = 4 - 4 + 2 = 2

Example reject loop: V(g) = 3 - 3 + 2 = 2

McCabe's software metric is simply expressed, the number of keywords such as if, while, case or for added by the factor +1. An interesting conclusion of McCabe was also that with the help of the created graph an evaluation of the programming style could be done, and thus even the programmer of the considered software could be identified.

Informations:
Englisch: McCabe
Updated at: 03.11.2013
#Words: 469
Links: measurement, software (SW), metric, framework, contrast
Translations: DE
Sharing:    

All rights reserved DATACOM Buchverlag GmbH © 2024