Cohesion refers to the degree to which a module's instructions are functionally related.
Highly cohesive modules contain instructions that collectively work together to solve a specific task.goal is to ensure that modules exhibit a high degree of cohesiveness.
Programs that are implemented with highly cohesive modules tend to be easier to understand, modify, and maintain. There are seven types or levels of cohesion and they are as follows: (from most desirable to least desirable)
· Functional cohesion — are modules whose instruction are related because they collectively work together to accomplish a single well-define function.
· Sequential cohesion — are modules whose instructions are related because the output data from one instruction is used as input data to the next instruction.
· Communicational cohesion — are modules whose instructions accomplish tasks that utilize the same piece(s) of data.
· Procedural cohesion — are modules whose instructions accomplish different tasks, yet have been combined because there is a specific order in which the tasks are to be completed.
· Temporal cohesion — are modules whose instructions appear to have been grouped together into a module because of ―time‖.
Logical cohesion — is modules that contain instructions that appear to be related because they fall into the same logical class of functions.
Coincidental cohesion — is modules that contain instructions that have little or no relationship to one another.