Module cohesion
Also known as Module cohesion, Module cohesion in software engineering
Definition
The degree to which the elements of a module support one focused purpose.
What it means
Module cohesion describes how strongly the functions, types, and data in a module belong together. High cohesion usually makes ownership, testing, and change impact easier to reason about. The assessment can be qualitative or based on shared data and change history, but the chosen method should be stated.
Example
A module contains authorization policy, CSV formatting, and retry scheduling. Commit history shows they change for different reasons, supporting a split into more coherent modules.
Limitations
Cohesion is not a simple universal score. A facade may intentionally gather operations, and a small module may be cohesive despite sharing little state. Use domain responsibility and change reasons rather than file size alone.
How to use the signal
Compare ownership and change reasons with shared data, since a facade may be coherent without sharing much state.
Weave can help compare cohesion changes with review scope and rework. Combine code structure with history so a refactor is judged by improved reasoning and delivery outcomes.
How this relates to Weave
Weave can help compare cohesion changes with review scope and rework. Combine code structure with history so a refactor is judged by improved reasoning and delivery outcomes.
Explore Engineering intelligence