Coupling and Cohesion
Learn about coupling and cohesion in software.
Let’s understand what coupling and cohesion are and how they factor in the maintainability of any system.
Coupling
Coupling is the measure of dependency between modules/components. In other words, it is the degree of interdependence between two modules/components. Two modules/components would be considered interdependent if a change in one requires a change in the other.
Measuring coupling
The degree of coupling between modules is determined by the following:
- The number of interfaces between modules (quantity)
- The complexity of each interface (determined by the type of communication) (quality)
Why is a high degree of coupling bad?
A high degree of coupling between two modules would mean strong interconnections between the modules. This means that the modules would have a high dependence on one another. This would result in a system where the modules are difficult to build, test, reuse, and understand. The system would therefore be difficult to ...