Explain Cohesion

Cohesion is a measure that defines the degree of intra-dependability within elements of a module. The greater the cohesion, the better is the program design.

  • Cohesion is an indication of the relative functional strength of a module
  • A cohesive module performs a single task, requiring little interaction with other components in other parts of a program.Stated simply, a cohesive module should (ideally) do just one thing.
  • Cohesion is a measure of functional strength of a module
  • A module having high cohesion and low coupling is said to be functionally independent of other modules. By the term functional independence, we mean that a cohesive module performs a single task or function.

Classification Cohesion

There are seven types of cohesion

  • Co-incidental cohesion – It is unplanned and random cohesion, which might be the result of breaking the program into smaller modules for the sake of modularization. Because it is unplanned, it may serve confusion to the programmers and is generally not-accepted.
  •  Logical cohesion – When logically categorized elements are put together into a module, it is called logical cohesion.
  •  Temporal Cohesion – When elements of module are organized such that they are processed at a similar point in time, it is called temporal cohesion.
  •  Procedural cohesion – When elements of module are grouped together, which are executed sequentially in order to perform a task, it is called procedural cohesion.
  •  Communicational cohesion – When elements of module are grouped together, which are executed sequentially and work on same data (information), it is called communicational cohesion.
  •  Sequential cohesion – When elements of module are grouped because the output of one element serves as input to another and so on, it is called sequential cohesion.
  • Functional cohesion – It is considered to be the highest degree of cohesion, and it is highly expected. Elements of module in functional cohesion are grouped because they all contribute to a single well-defined function. It can also be reused.

Leave a Reply