# Measuring the Structure

Measurement of structural properties of a software is important for estimating the development effort as well as for the maintenance of the product. The structure of requirements, design, and code helps understand the difficulty that arises in converting one product to another, in testing a product, or in predicting the external software attributes from early internal product measures.

## Types of Structural Measures

The structure of software has three parts. They are −

**Control-flow structure**− It is the sequence in which instructions are executed in a program.**Data-flow structure**− It is the behavior of the data as it interacts with the program.**Data structure**− It is the organization of the data elements in the form of lists, queue, stacks, or other well-defined structures along with algorithm for creating, modifying, or deleting them.

## Measuring Control-Flow Structure

The control flow measures are usually modeled with directed graph, where each node or point corresponds to program statements, and each arc or directed edge indicates the flow of control from one statement to another. Theses graphs are called control-flow graph or directed graph.

If **‘m’** is a structural measure defined in terms of the flow graph model, and if program **A** is structurally more complex than program **B**, then the measure **m(A)** should be greater than **m(B)**.

## Measuring Data-Flow Structure

Data flow or information flow can be inter-modular (flow of information within the modules) or intra-modular (flow of information between individual modules and the rest of the system).

According to the way in which data is moving through the system, it can be classified into the following −

**Local direct flow**− If either a module invokes a second module and passes information to it or the invoked module returns a result to the caller.**Local indirect flow**− If the invoked module returns information that is subsequently passed to a second invoked module.**Global flow**− If information flows from one module to another through a global data structure.

Information flow complexity can be expressed according to Henry and Kafura as,

**Information flow complexity (M) = length (M) × fan-in (M) × (fan-out (M)) ^{2}**

Where,

**Fan-in (M)**− The number of local flows that terminate at M + the number of data structures from which the information is retrieved by M.**Fan–out (M)**− The number of local flows that emanate from M + the number of data structures that are updated by M.

## Measuring Data Structure

Data structure can be both **local** and **global**.

**Locally**, the amount of structure in each data item will be measured. A graph-theoretic approach can be used to analyze and measure the properties of individual data structures. In that simple data types such as integers, characters, and Booleans are viewed as primes and the various operations that enable us to build more complex data structures are considered. Data structure measures can then be defined hierarchically in terms of values for the primes and values associated with the various operations.

**Globally**, a count of the total number of user-defined variables will be measured.