Coupling is the measure of the degree of independence between modules. Two modules that are strongly connected, highly dependent on each other are called highly coupled modules. When two modules have weak interconnection between them then they are loosely coupled modules. Coupling increases with the complexity of the interface.
The priority of coupling from lowest to highest is given in the table below.
Following are the couplings: which are shown here on the basis of their priority and by taking the example of two modules assuming A and B.
There are six types of coupling:
i. Data coupling
ii. Stamp coupling
iii. Control coupling
iv. External coupling
v. Common coupling
vii. Content coupling
Types of coupling:
- Data coupling is when a module passes from a non-global variable to another module.
- Modules can only communicate through passing data elements or informational flags.
- The two modules have no need to know what goes on inside the other module.
- Stamp coupling occurs when a module passes from a non-global data structure or entire structure to another module.
- A change in the data structure in one module will affect all modules that use it.
- The two modules using stamp coupling must have some knowledge of the internal workings of other modules that use the same data structure.
- Module A and B are said to be controled couple if they communicate bypassing of control information.
- The sending module must know a great deal about the inner workings of the receiving module.
- A form of coupling in which a module has a dependency to another module, external to the software being developed or to a particular type of hardware.
- This is basically related to the communication to external tools and devices.
- In common coupling, both modules A and B share the same data.
- With common coupling, it can be difficult to determine which module is responsible for having a set of variables to a particular value.
- It is not a good type of coupling because if we want to modify the data then we have to check all modules who are sharing the data.
- Content coupling occurs when one module directly refers to the inner workings of another module.
- Modules are highly interdependent to each other. One module can alter data in another module or change a statement coded in another module.
Read more about ISO 9000 Certification