liveBook · Manning

Coupling

As explained in The Coder Cafe

Loose coupling is a software design condition in which components have limited dependencies and changes to one have minimal impact on the others.

Coupling is the degree to which two components depend on each other. A component might be a function, class, module, or application. With tight coupling, a change to one is likely to affect the other. Loose coupling limits that impact by reducing the assumptions components make about each other. section 4.9

A change that spreads

If one class directly modifies another class’s internal data, it relies on that data keeping the same structure. Changing the second class can then force changes to the first. Household plumbing offers the same intuition: flushing a toilet that makes the shower run cold reveals a stronger dependency than a brief pressure drop that leaves the temperature stable. section 4.9

When assessing coupling, ask what a dependency costs:

  • Maintenance: Will changing one component require changes elsewhere? section 4.9
  • Understanding and debugging: Do interconnected components make behavior harder to reason about? section 4.9
  • Testing: Can a component be tested in isolation, or do changes require updates to other components’ tests? section 4.9

Calling two components “coupled” is only a starting point. Name the dependency and the change that would expose it. Control coupling concerns one component controlling another’s behavior; temporal coupling concerns components needing to be active at the same time. This makes coupling a useful structural question alongside cohesion, rather than a label for every interaction. section 4.10.1 section 4.7

How The Coder Cafe covers it

How deep it goes
Defines tight and loose coupling, traces practical consequences, and distinguishes control from temporal coupling without prescribing a redesign procedure.
Examples
Illustrates dependency with shared household plumbing and a class that directly modifies another class’s internal data.
What it assumes
Defines coupling from component dependencies while using functions, classes, modules, and household plumbing as familiar starting points.
What you can do after
Evaluate/understand how a specific dependency could propagate changes or obstruct isolated testing.
How it connects
Connects coupling to cohesion, cognitive load, maintainability, complexity, and testability.

Also explained in

Compare how 22 books explain coupling →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Coder Cafe. The section links point to the parts of the book it draws on.