Intramodule Cohesion

Cohesion is the measure of strength of the association of elements within a module. Modules whose elements are strongly and genuinely related to each other are desired. A module should be highly cohesive.

Coincidental cohesion

A module has coincidental cohesion if its elements have no meaningful relationship to one another.


A perhaps mythological story. A manager who is responsible for maintaining a largeish (say, 10000 line of code) FORTRAN program reads about modularity and how helpful it is in improving programming understanding of programs.

The manager tells his chief programmer to restructure the FORTRAN program (which is a one large subprogram) into modules. He's gonna get those benefits.

The chief programmer, who thinks he has better uses for his time, decides the fastest way to make modules out of the program is to take a ruler, measure down every 6 inches in the program listing and draw a line. At each line, he inserts a call to a new subprogram, and after that call creates the header for the new subprogram.

These "modules" exhibit ultimate coincidental cohesion.

Logical cohesion

A logically cohesive module is one whose elements perform similar activities and in which the activities to be executed are chosen from outside the module.

Temporal cohesion

A temporally cohesive module is one whose elements are functions that are related in time.


Consider a module called "On_Really_Bad_Failure" that is invoked when a Really_Bad_Failure happens. The module performs several tasks that are not functionally similar or logically related, but all tasks need to happen at the moment when the failure occurs. The module might

Procedural cohesion

A procedurally cohesive module is one whose elements are involved in different activities, but the activities are sequential.

Communicational cohesion

A communicationally cohesive module is one whose elements perform different functions, but each function references the same input information or output.

Sequential cohesion

A sequentially cohesive module is one whose functions are relaed such that output data from one function serves as input data to the next function.

Functional cohesion

A functionally cohesive module is one in which all of the elements contribute to a single, well-defined task. Object-oriented languages tend to support this level of cohesion better than earlier languages do.