Chapter 17. Coupling

Two parts of a software system are coupled if a change in one might cause a change in the other.

Neal Ford et al., Software Architecture: The Hard Parts (O’Reilly 2021)

17.0 Introduction

Coupling is the degree of interdependence between your objects. Higher coupling means that changes in one object can have a significant impact on others, whereas low coupling means that objects are relatively independent and changes in one of them have little impact on others. High coupling can make it difficult to make changes to software without unintended consequences. Most of the work in a large software system lowers accidental coupling. Systems with high coupling are harder to understand and maintain, the interactions between objects are more complex, and changes cause ripple effects throughout the codebase. An entangled system with desirable emergent properties can be fascinating, while a badly coupled one can become a maintenance nightmare.

17.1 Making Hidden Assumptions Explicit


You have code with hidden assumptions not explicit in your solution and they affect your system’s behavior.


Keep your code explicit.


Software is about contracts, and ambiguous contracts are a nightmare. Hidden assumptions are underlying beliefs or expectations not explicitly stated in the code. They are still present and can impact the behavior of the software. Various factors can give rise to assumptions, such as incomplete requirements, incorrect presumptions ...

Get Clean Code Cookbook 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.