Definition: High cohesion

High cohesion is a software engineering concept that refers to how closely all the routines in a class, or all the code in a routine, support a central purpose. Classes that contain strongly related functionalities are described as having high cohesion; the heuristic goal is to make cohesion as high as possible.

In other words, cohesion represents the degree to which a part of a codebase forms a logically single and atomic unit. Therefore, in essence, high cohesion means keeping parts of a codebase that are related to each other in a single place. A general rule of thumb is to make sure that any software has high cohesion.

High cohesion is often paired up with loose coupling.

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved