Skip to Content
Clean Code Cookbook
book

Clean Code Cookbook

by Maximiliano Contieri
September 2023
Intermediate to advanced
430 pages
8h 6m
English
O'Reilly Media, Inc.
Book available
Content preview from Clean Code Cookbook

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

Problem

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

Solution

Keep your code explicit.

Discussion

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

GitOps Cookbook

GitOps Cookbook

Natale Vinto, Alex Soto Bueno
Data-Oriented Programming

Data-Oriented Programming

Yehonathan Sharvit

Publisher Resources

ISBN: 9781098144715Errata PageSupplemental Content