Coupling
Definition
Coupling is a measure of the degree of interdependence between two modules — how much one module relies on or is connected to another. Good design aims for LOW coupling — modules should be as independent as possible.
Types of Coupling (from Worst/Highest to Best/Lowest)
| Type | Description | Coupling Level |
|---|---|---|
| Content Coupling | One module directly modifies or relies on the internal data/code of another module | Worst (Highest) |
| Common Coupling | Modules share global data | Very High |
| External Coupling | Modules share an externally imposed data format/protocol/interface | High |
| Control Coupling | One module passes control information (a flag) telling another module what to do | Moderate |
| Stamp Coupling | Modules share a composite data structure (e.g., a whole record/struct) but only use part of it | Low-Moderate |
| Data Coupling | Modules communicate by passing only the specific data needed (simple parameters) | Best (Lowest) |
| No Coupling | Modules are completely independent (rare in practice) | Ideal but rare |
Content > Common > External > Control > Stamp > Data > No Coupling
(Worst) (Best)
Why Low Coupling Matters
- Modules can be modified independently without breaking others
- Easier to understand, test, and reuse modules in isolation
- Reduces ripple effect of changes across the system
How to Reduce Coupling
- Pass only necessary data (not entire structures) between modules
- Avoid global/shared variables
- Use well-defined interfaces
- Avoid one module directly accessing another's internal implementation
Exam tip: Memorize the coupling types from worst to best: Content → Common → External → Control → Stamp → Data. A very frequently asked "list and explain with example" question, often paired with Cohesion.