Chapter 8. Loose Coupling
We build our computers the way we build our cities—over time, without a plan, on top of ruins.1
Ellen Ullman, The Dumbing-down of Programming (May 1998)
Coupling is one of those fascinating topics that seem straightforward in theory but are actually quite challenging in practice. As we’ll discuss, there are lots of ways in which coupling can be introduced in a system, which means it’s also a big subject. As you might imagine, this chapter is an ambitious one, and we cover a lot of ground.
First, we’ll introduce the subject, diving more deeply into the concept of “coupling,” and discussing the relative merits of “loose” versus “tight” coupling. We’ll present some of the most common coupling mechanisms, and how some kinds of tight coupling can lead to the dreaded “distributed monolith.”
Next, we’ll talk about inter-service communications, and how fragile exchange protocols are a very common way of introducing tight coupling to distributed systems. We’ll cover some of the common protocols in use today to minimize the degree of coupling between two services.
In the third part, we’ll change direction for a bit, away from distributed systems and into the implementations of the services themselves. We’ll talk about services as code artifacts, subject to coupling resulting from mingling implementations and violating separation of concerns, and present the use of plug-ins as a way to dynamically add implementations.
Finally, we’ll close with a discussion of ...
Get Cloud Native Go now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.