liveBook · Manning

Cohesion

Cohesion is the degree to which the elements and responsibilities within a software unit are related and contribute to a coherent purpose.

How 7 Manning books explain it

Grokking Software Architecture

Cohesion is the degree to which the responsibilities within a software component belong together.

How it is used
Uses cohesion alongside coupling to assess whether responsibilities are separated into maintainable components.
How deep it goes
Defines high and low cohesion through analogies and contrasting classes, then provides a comment-driven audit.
Examples
Contrasts a shipping-cost class with a class mixing authentication, logging, and currency formatting, and examines an anemic Order object.
What you can do after
Practice performing a comment-driven structural audit to spot unrelated responsibilities in a method or class.

Read how Grokking Software Architecture explains cohesion →

Microservices Patterns, Second Edition

Cohesion is the degree to which the elements or responsibilities within a software component belong together.

How it is used
Guides grouping decisions that localize changes and support modifiability and team autonomy.
How deep it goes
Defines cohesion through tightly coupled child elements and explains its consequences across the software design hierarchy.
Examples
Uses Customer Management and Order Management to illustrate how coupling affects the spread of changes between subdomains.
What you can do after
Evaluate and understand grouping decisions by considering change localization and microservice boundary trade-offs.

Read how Microservices Patterns, Second Edition explains cohesion →

The Coder Cafe

Cohesion is a software design property describing how strongly the elements within an aggregate belong together and serve a common purpose.

How it is used
Assesses whether the parts of a function, class, or module serve a common purpose.
How deep it goes
Defines cohesion, illustrates high and low cohesion, and identifies benefits and code smells.
Examples
Contrasts bedroom contents serving unrelated purposes with contents supporting rest and morning preparation.
What you can do after
Evaluate/understand it by checking whether an aggregate's parts share a purpose and recognizing signs of scattered responsibility.

Read how The Coder Cafe explains cohesion →

Functional Design and Architecture: Examples in Haskell

Cohesion is the degree to which the responsibilities and internals of a software component belong together.

How it is used
Uses cohesion with coupling to keep complexity manageable during object-oriented and functional design.
How deep it goes
Defines blurred responsibility, diagnoses a coupled implementation, and refactors it through interfaces without detailing cohesion metrics.
Examples
Uses a thermometer-to-server Observer, ISensor and IConnection interfaces, and an analogous Haskell temperature workflow.
What you can do after
Evaluate and refactor components by isolating responsibilities behind interfaces and checking cohesion across object-oriented and functional code.

Read how Functional Design and Architecture: Examples in Haskell explains cohesion →

Architecture Modernization: Socio-technical alignment of software, strategy, and structure

The degree to which the concepts, events, rules, and activities within a subdomain are mutually related and form a coherent whole.

How it is used
Uses related concepts and coordinated change to shape subdomain boundaries, team ownership, and sustainable evolution.
How deep it goes
Analyzes purpose, event consistency, relatedness, team ownership, and coordinated change, stopping short of implementation detail.
Examples
Uses loyalty levels, Pickup and Dropoff events, and iterative accounting boundary designs as concrete examples.
What you can do after
Apply it via subdomain descriptions, sense-check questions, concrete scenarios, and a subdomain overview canvas to refine boundaries.

Read how Architecture Modernization: Socio-technical alignment of software, strategy, and structure explains cohesion →

The Art of Code

High cohesion is a software-design condition in which a component's parts are closely related and focused on one responsibility.

How it is used
Guides separation of concerns by keeping responsibility-specific logic together within modules, layers, or classes.
How deep it goes
Explains cohesion through a class-level before-and-after example and connects it to coupling, without descending into implementation internals.
Examples
Uses OrderTools, PricingService, NotificationService, and architecture-review signals such as large classes and misplaced responsibilities.
What you can do after
Evaluate components for unrelated responsibilities and reorganize them into focused units with clearer boundaries.

Read how The Art of Code explains cohesion →

Shipping Go: Develop, deliver, discuss, design, and go again

Cohesion is the degree to which the responsibilities of a software module or component belong together.

How it is used
Guides grouping service responsibilities into focused interfaces and components early in development.
How deep it goes
Defines high and low cohesion and illustrates each with class examples, without offering a measurement method.
Examples
Contrasts Validation with UserRegistrationValidation and broad responsibilities with clearly defined structures.
What you can do after
Evaluate whether a component groups one well-defined task or combines broad responsibilities.

Read how Shipping Go: Develop, deliver, discuss, design, and go again explains cohesion →

Also covered in

What to know first

Related concepts

Questions about cohesion

What is cohesion?

Cohesion is the degree to which the elements and responsibilities within a software unit are related and contribute to a coherent purpose.

Which Manning books explain cohesion?

Grokking Software Architecture, Microservices Patterns, Second Edition, The Coder Cafe, Functional Design and Architecture: Examples in Haskell, Architecture Modernization: Socio-technical alignment of software, strategy, and structure, The Art of Code and Shipping Go: Develop, deliver, discuss, design, and go again.

What should I know before learning cohesion?

Manning books that teach cohesion usually introduce class, method, interface and component first.

What kinds of cohesion are there?

Kinds of cohesion include communicational cohesion and sequential cohesion.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.