Coupling

Coupling is the degree of dependency between software modules.

Elaboration:

  • Types:
    • Tightly Coupled: Modules depend heavily on each other (harder to modify).
    • Loosely Coupled: Modules interact with minimal dependency (better maintainability).
  • Goal: Achieve low coupling for flexible and reusable code.

Example:

  • Tightly Coupled: If Module A directly calls functions of Module B, changing B may break A.
  • Loosely Coupled: If Module A interacts with Module B via interfaces, changes in B wonโ€™t affect A.