This is an old revision of the document!
Table of Contents
Low Coupling (LC)
Variants and Alternative Names
- Loose Coupling
Context
Principle Statement
Description
A module should not interact with too many other modules. Furthermore if a module A interacts with another module B, this interaction should be loose, which means that A should not make too many assumptions about B.
Rationale
If a module A interacts with a module B, there is a certain dependency between these modules. When for example A uses a certain functionality of B, then A depends on B. A makes the assumption that B provides a certain service, and moreover it makes assumptions on how this service can be used (by which mechanism, which parameters, etc.). If one of these assumptions is not true anymore because B has changed for some reason, A also has to change. So the fewer dependencies there are, the less likely it is that A stops working and has to be changed.
Furthermore A makes many and detailed assumptions about B, there is also a high probability that A has to change despite only relying one one other module. This is because in such a case A also needs to change when only a certain detail of B changes.
But if coupling is low, there are only few assumptions between the modules which can be violated. This reduces the chance of ripple effects.
Strategies
- Indirection:
- Dependency Inversion/Abstract Couplings:
- Use lower form of coupling:
- Merge modules:
- Hide information
Origin
Evidence
Relations to Other Principles
Generalizations
Specializations
- Tell, don't Ask/Information Expert (TdA/IE): Adhering to the information expert principle leads to low coupling as there is less need to communicate with other modules to get the necessary information.
- Constantine's Law: Constantine's Law is just the combination of the two principles LC and HC.
- Dependency Inversion Principle (DIP): LC aims at reducing the dependencies to other modules. One way to do so is to only depend on abstractions. DIP is about this aspect.
Contrary Principles
- Keep It Simple Stupid (KISS): Reducing the coupling often involves the use of complicated interaction patterns, indirections, etc.
- High Cohesion (HC): A system consisting of one single module has a very low coupling as there are no dependencies on other modules. But such a system also has low cohesion. The other extreme, very many highly cohesive modules, naturally has a higher coupling between the modules. So here a compromise has to be found.
Complementary Principles
- Model Principle (MP): LC aims at reducing the dependencies to other modules. So a module shall depend on only a few others. MP now tells which dependencies are allowed and which aren't.
- Information Hiding/Encapsulation (IH/E): Higher forms of couplings (especially content couplings) break encapsulation.
Principle Collections
Example
Description Status
Further Reading
- Albert Endres and Dieter Rombach: A Handbook of Software and Systems Engineering. p. 43pp.
- Martin Fowler: Reducing Coupling