8 Measuring internal product attributes: structure


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

8.3 Modularity and information flow attributes

The cohesion of a module is the extent to which its individual components are needed to perform the same task. An ordinal classification (Yourdon and Constantine, 1979) ordered from most desirable to least desirable is:
  1. Functional: the module performs a single function.
  2. Sequential: several functions in the order of specifiaction.
  3. Communicational: several functions on the same data.
  4. Procedural: several functions related only to a general procedure affected by the software.
  5. Temporal: several functions that must occur within the same timespan.
  6. Logical: several functions only related logically.
  7. Coincidental: several unrelated functions.
One simple inter-modular measure of cohesion may be defined by:

Cohesion ratio = # functional modules / # all modules

Henry and Kafura's measure of the total level of information flow between individual modules and the rest of a system is well known, but has also been criticized as measuring both control flow and information flow (Shepperd).
We say that local direct flow exists if 1) a module invokes a second module and passes data to it; or 2) the invoked module returns a result to the caller.
A local indirect flow exists if the invoked module returns information that is subsequently passed to a second invoked module.
A global flow exists if information flows from one module to another via a global data structure.
The fan-in of a module M is the number of local flows that terminate at M, plus the number of data structures from which information is retrieved by M.
The fan-out of a module M is the number of local flows that emanate from M, plus the number of data structures that are updated by M.
Based on these concepts, Henry and Kafura define information flow complexity as (see Figure 8.24 for an example):

i-f-c(M) = length(M) x (fan-in(M) x fan-out(M))2