Cohesion is the measure of functional relatedness of elements within a single module. When dividing a system into modules, it must ensure that the activities within the module are tightly bound to one another.
There are seven types of cohesion:
1. Functional cohesion
2. Sequential cohesion
3. Communicational cohesion
4. Procedural cohesion
5. Temporal cohesion
6. Logical cohesion
7. Coincidental cohesion
Types of cohesion
Functional cohesion:
- All activities in the module are functionally related or they are performing a similar function.
- The chances of a change request affecting more than one module are low if the modules are based on functionality. Hence, this is the best form of cohesion.
Sequential cohesion:
- In this scheme of cohesion, modules are divided into a series of activities such that the output of one module becomes the input to the next module and the chain continues.
Communicational cohesion:
- This form of cohesion relates to a situation where all modules share some common data.
- This form of cohesion has clearly defined boundaries, inputs, and outputs.
Procedural cohesion:
- In this type of cohesion, activities share the same procedural implementation.
Temporal cohesion:
- In this type of module division, activities occurring in the same period are grouping together.
- The set of functions responsible for initialization, start-up activities such as setting program counters or control flags associated with programs exhibit temporal cohesion.
Logical cohesion:
- In logical cohesion, activities belonging to the same category are grouped together.
- We can group all reporting activities together or all querying activities together.
Coincidental cohesion:
- The Coincidental cohesion exists in modules that contain instructions that have little or no relationship to one another.
- Coincidental cohesion is can be avoid as far as possible.
Read more about Coupling