Lack of cohesion
Also known as Lack of cohesion, Lack of cohesion in software engineering
Definition
A family of measures that estimates how weakly the responsibilities or data uses within a class are connected.
What it means
Lack of cohesion measures whether methods in a class share fields, concepts, or responsibilities. High lack of cohesion can suggest that a class contains unrelated work and may be a candidate for separation. Different formulas produce different values, so the metric name should always be paired with its definition.
Example
A class handles invoice calculation, email formatting, and retry scheduling. Its methods share little state and change for different reasons, giving the team concrete evidence for splitting responsibilities.
Limitations
Cohesion formulas are proxies and can misread functional programming styles, immutable data, or deliberately small coordinators. A high score may be acceptable when a class represents one workflow. Inspect change reasons and ownership before refactoring.
How to use the signal
Read the class through its reasons for change, because shared state alone is not a complete definition of responsibility.
Weave can help reveal whether low-cohesion classes attract cross-team reviews or repeated changes. Combine the signal with pull request history and design discussion rather than applying a threshold mechanically.
How this relates to Weave
Weave can help reveal whether low-cohesion classes attract cross-team reviews or repeated changes. Combine the signal with pull request history and design discussion rather than applying a threshold mechanically.
Explore Engineering intelligence