


| |
Classifying module interfaces
The following table is a useful tool for classifying the
coupling between two modules.
|
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
|
Direct
reference between modules
|
Y
|
N
|
N
|
N
|
N
|
N
|
N
|
N
|
|
Modules
are packaged together
|
-
|
Y
|
N
|
N
|
N
|
N
|
N
|
N
|
|
External,
global, public
|
-
|
-
|
Y
|
Y
|
N
|
N
|
N
|
N
|
|
Control
information (determines function)
|
-
|
-
|
-
|
-
|
Y
|
N
|
N
|
N
|
|
Data
structure
|
-
|
-
|
Y
|
N
|
-
|
Y
|
N
|
N
|
|
The
module doesn’t interface with another
|
N
|
N
|
N
|
N
|
N
|
N
|
N
|
Y
|
|
Content
|
X
|
X
|
|
|
|
|
|
|
|
Common
|
|
|
X
|
|
|
|
|
|
|
External
|
|
|
|
X
|
|
|
|
|
|
Control
|
|
|
|
|
X
|
|
|
|
|
Stamp
|
|
|
|
|
|
X
|
|
|
|
Data
|
|
|
|
|
|
|
X
|
|
|
None
|
|
|
|
|
|
|
|
X
|
One problem with classifying the coupling between modules is distinguishing between no coupling and content, common and external coupling.
Classifying the coupling in a program
Establishing the coupling of a program is a multiple step
process:
-
Acquire or develop a completely annotated structure chart or
interaction diagram. These
diagrams will only describe the formal interfaces used by the components.
For content, common and external coupling, the analysis must exam the
sources code.
- Compare each component to every other component in the
program. There are a number of
methods to accomplish this, but the first is to establish a method of
creating pairs of modules.
Method
1. Create a table with
the names components on the rows and columns.
Place an “X” in where the module name on the row and column are the
same, unless the component is recursive.
Also place an “X” in the rows above that intersection.
Then record the coupling for each row and column pair.
Given a program with modules labeled:
A, B, C, D, E.
|
Module |
A
|
B
|
C
|
D
|
E
|
|
A
|
X
|
X
|
X
|
X
|
X
|
|
B
|
Data
|
X
|
X
|
X
|
X
|
|
C
|
Stamp
|
Stamp
|
X
|
X
|
X
|
|
D
|
None
|
Data
|
None
|
X
|
X
|
|
E
|
None
|
None
|
Data
|
None
|
X
|
Method
2.
For larger program this method has a number of advantages.
Construct a table that contains two columns and one row for each module
in the program. In the title, write
the name of one module and place a “X” in the row with the same name.
Then record the coupling for each module listed and the module in the
title. Given a program with modules
labeled A, B, C, D, E.
|
Coupling
between _________ and
|
is
|
|
A
|
|
|
B
|
|
|
C
|
|
|
D
|
|
|
E
|
|
3.
After classifying all of the modules in the program the next step is to
find the module pair with the lowest level of classification.
That level of coupling then becomes the level of coupling for the
program. For example, if a program
had 9 modules pairs with data coupling and one module pair with common coupling
then the program would have common coupling.
|