Middle
What is a hook in code?
sobes.tech AI
Answer from AI
Coupling is the degree of interdependence between modules, classes, or components of a program. High coupling means that a change in one component is likely to require changes in another.
Types of coupling (from strong to weak):
- Content coupling: A module accesses or modifies the internal content of another module.
- Common coupling: Modules use shared global data.
- External coupling: Modules depend on data formats transmitted externally or on external devices/interfaces.
- Control coupling: One module passes control flags to another, influencing its logic.
- Stamp coupling: One module passes a data structure to another, but the second module only uses part of this structure.
- Data coupling: One module passes only the necessary data to another.
- Message passing (declarative): Modules interact by passing messages without knowledge of each other's internal structure (typical for events, web services).
- No coupling: Modules are completely independent.
Low coupling is desirable as it increases testability, maintainability, and system flexibility.