Cohesion

Cohesion image
Cohesion is about how closely related the responsibilities of a module, class, or function are. A cohesive unit does one job and does it well. High cohesion means that everything inside that unit contributes directly to a single, well-defined purpose. Low cohesion means the unit is doing too many unrelated things, which often makes it harder to understand, test, and maintain.

For example, a class that only handles user authentication is cohesive, whereas a class that mixes authentication, report generation, and email notifications is not. High cohesion helps improve clarity, reduces duplication, and ensures that changes are easier to manage.

When systems have high cohesion and low coupling together, they become much easier to test because each part has a clear focus and fewer dependencies on other parts.
Explore MoT
Don’t Be Left Behind: Close the Gap Between Test and Delivery image
Wed, 12 Nov
Align testing and delivery to reduce lead time and improve deployment frequency.
MoT Software Testing Essentials Certificate image
Boost your career in software testing with the MoT Software Testing Essentials Certificate. Learn essential skills, from basic testing techniques to advanced risk analysis, crafted by industry experts.
This Week in Quality image
Debrief the week in Quality via a community radio show hosted by Simon Tomes and members of the community
Subscribe to our newsletter
We'll keep you up to date on all the testing trends.