Coupling and Cohesion



  • Coupling refers to the degree to which one class knows about or uses members of another class.
  • Loose coupling is the desirable state of having classes that are well encapsulated, minimize references to each other, and limit the breadth of API usage.
  • Tight coupling is the undesirable state of having classes that break the rules of loose coupling.
  • Cohesion refers to the degree in which a class has a single, well-defined role or responsibility.
  • High cohesion is the desirable state of a class whose members support a single, well-focused role or responsibility.
  • Low cohesion is the undesirable state of a class whose members support multiple, unfocused roles or responsibilities.