This is an old revision of the document!
Table of Contents
High Cohesion (HC)
Variants and Alternative Names
Context
Definition
Description
The cohesion of a module is a measure for how well the internal parts of a module (e.g. the methods and attributes of a class) belong together. Having a high cohesion means, that a module should only comprise responsibilities which belong together.
Several kinds of cohesion can be distinguished some of which are strong and some of which are loose. So strong forms of coupling should be preferred: add explanation of cohesion types
Rationale
Not adhering to this principle, i.e. having a low cohesion, means that one module has several unrelated or only loosely related responsibilities. A change in the requirements for one of these may thus also affect the others which would not be the case in a highly cohesive module.
Origin
Evidence
Relations to Other Principles
Generalizations
Specializations
- Information Expert: Adhering to information expert means that a module only has responsibilities which belong together. So this increases cohesion.
Contrary Principles
- Keep It Simple Stupid: Sometimes it is simpler to assign a minor unrelated responsibility to a module, which lowers the cohesion. On the other hand introducing a new module for the responsibility would be better in terms of cohesion but increases complexity as it increases the number of modules.
Complementary Principles
Principle Collections
Example
Description Status
Further Reading
- Albert Endres and Dieter Rombach: A Handbook of Software and Systems Engineering. p. 43pp.