liveBook · Manning

Tight coupling

As explained in Microservices Patterns, Second Edition

A relationship in which software elements have substantial dependencies on one another.

Tight coupling is a relationship in which one software element can significantly influence another. Its consequences depend on how that influence occurs: a change can spread across code and teams, while a failure or shared infrastructure can affect runtime behavior. section 4.1 section 4.0

Examine coupling at different points in the software lifecycle:

  • Design-time coupling makes a change to one element likely to require changes to another. Cross-team changes add coordination and waiting. section 4.2.2
  • Build-time coupling requires another element to be recompiled and retested when one element changes. section 7.3.2
  • Runtime coupling allows one element’s failure to cause another to fail; it can reduce availability and increase latency. section 7.3.2
  • Infrastructure coupling arises when elements share infrastructure, such as a database, and one element’s behavior affects another. section 7.3.2

Changes across technical layers

In a layered monolith, consumer functionality can be scattered across web, domain, and persistence layers. Adding a consumer attribute may require changes to request handlers, business logic, and persistence logic. These non-local changes reduce modifiability and can force subdomain teams to work across all three layers. section 6.2.1

Figure 6.7 In a technology-oriented layered architecture, the code for each subdomain is scattered across the technical layers. As a result, there’s a mismatch between the application architecture and the subdomains and the teams that develop them.
layered monolithic architecture

The diagram shows how subdomain code and team responsibilities cross technical layers. section 6.2.1

Changing a service API

A breaking change to a Consumer Service API can break an Order Service client. To avoid an outage, the provider can add a new API version alongside the old one, ask client teams to migrate, and remove the old version only after migration. This preserves compatibility but requires coordination. section 7.3.2

Service boundaries do not automatically eliminate coupling. Very fine-grained services can create tight design-time and runtime coupling and poor performance. CQRS also creates event contracts that providers and view services must design and evolve together. Choose boundaries and patterns for a tangible benefit; consider colocating subdomains when necessary to avoid runtime coupling. section 2.3 section 7.3.2 section 13.2.3

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines coupling and distinguishes four types, illustrating their consequences and a coordinated API migration.
Examples
Illustrates a consumer attribute change across layers and a breaking Consumer Service API change affecting an Order Service.
What you can do after
Evaluate architecture for change propagation, coordination, and runtime risks when choosing service boundaries or patterns.
How it connects
Connects coupling to loose coupling, microservices, layered architecture, CQRS, and team autonomy.

Also explained in

Compare how 2 books explain tight coupling →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.