Spaghetti Code

Modularization


description

What is Cohesion?

Cohesion serves to determine how many of the elements within a module are related to each other. A module with low cohesion, not dedicated to a single task, causes complexity and difficult configurability.

Types of cohesions listed from strongest to weakest:

  • Functional: Module performs one action or achieves a single goal.
  • Informational: Module performs several actions with independent submodules for each.
  • Communicational: Submodules work on the same input data or contributes to the same output.
  • Procedural: Module performs a series of actions corresponding to steps followed by the product.
  • Temporal: Module performs a series of actions corresponding to time.
  • Logical: Logically related submodules but not functionally related.
  • Coincidental: Unrelated submodules.