8 Measuring internal product attributes: structure


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

8.1 Types of structural measures

We can think of structure as having at least three parts:
  1. Control flow: addresses the sequence in which instructions are executed in a program. This aspect of structure reflects the iterative and looping nature of programs.
  2. Data flow: follows the trail of a data item as it is created or handled by a program. Data-flow measures depict the behaviour of the data as it interacts with the program.
  3. Data structure: is the organization of data itself, independent of the program. The structure of data tells us a great deal about the difficulty in writing programs to handle the data.

8.2 Control-flow structure

A great deal of software metrics work has been devoted to measuring the control flow structure of imperative language programs or algorthms. The control flow measures are usually modeled with directed graphs, where each node (or point) corresponds to a program statement, and each arc (or directed edge) indicates the flow of control from one statement to another. Some further notations: See Figure 8.1 for an example and Figure 8.2 and 8.3 for flowgraphs of some "prime" program control constructs, the most common being Pn: sequence, D0: if-then, D1: if-then-else, Cn: case, D2: while-do, and D3: repeat-until.