Cohesion is a measure of the
functional strength of a module, whereas the coupling between two modules is a
measure of the degree of interaction (or interdependence) between the two
modules.
We can think of coupling as
follows. Two modules are said to be highly coupled, in either of the following
two situations arises:
1.
If the function calls between two modules
involve passing large chunks of the shared data, the modules are tightly
coupled.
2.
If the interaction occurs through some shared
data, then also we say that they are lightly coupled.
3.
If two modules either do not interact with each
other at all or at best interact by passing no data or only a few primitive
data items, they are said to have low coupling.
Cohesion
When the functions of the module
cooperate with each other for performing a single objective, then the module
has good cohesion. If the functions of the module has good cohesion. If the
functions of the module do very different things and do not cooperate with each
other to perform a single piece of work, then the module has every poor
cohesion.
Coincidental | Logical | Temporal
| Procedural | Communicational |Sequential | Function
Low
---------------------------------------------------------------------------------------------àHigh
Classification
of Coupling
Data|Stamp|Control|Common|Content
Low---------------------------------------------------àHigh
Data Coupling
Two modules are data coupled, if
they communicate using an elementary data is passed as a parameter between the
two, e.g., an integer, a float, a character, etc.
This data item should be problem related
and not used for control purpose.
Stamp Coupling
Two modules are stamp coupled, if
they communicate using a composite data item such as a record in PASCAL or a
structure in C.
Control Coupling
Control coupling exists between
two modules, if the data from one module is used to direct the order of
instruction execution in another.
Example, a flag set is one module
all tested in another module.
Common Coupling
Two modules are common coupled, if
they share some global data items.
Content Handling
Content coupling exists between
two modules, if they share code. That is, a jump from one module into the code
of another module can occur. Model high-level programming languages such as C
do not support such jumps occurs modules.
0 comments:
Post a Comment