next up previous
Next: Defensive Coding Up: Cohesion and Coupling Previous: Cohesion

Coupling

While strong cohesion within a routine is important, loose coupling is what we desire between routines. There are four criteria to use when evaluating coupling as shown in Figure 13. These criteria are applied to the various forms of coupling. Loose coupling occurs when the routines are low in size and high in intimacy, visibility, and flexibility. Routines can be coupled through data or control.

   table343
Table 13: Criteria for Evaluating Couplings

The levels of coupling refer to various ways data and control can be used (Figure 14). For example, normal couplings are preferred to data-structure coupling since the callee must ``know'' the structure and contend with the extra fields.

   table350
Table 14: Levels of Coupling



Steve Stevenson
Wed Feb 26 10:54:45 EST 1997