Brain Dump

Cohesion

Tags
comp-sci

A design metric that [see page 29, measures] how well a component fits together, that is whether everything in a bundle of code (referred to as a component) needs to be there.

In general a component should be highly cohesive, implementing a single logical entity or function, and changes (when required) should be localised to a single cohesive component. Components can be classes, modules or higher level groupings of code.

Table 1: Listing of various cohesive see page 30, [levels] and how strong they are.
CohesionStrengthDescription
Coincidental CohesionWeakParts of a component are simply bundled together
Logical AssociationWeakComponents performing similar functions are grouped
Temporal CohesionWeakComponents activated at the same time are grouped
Communicational CohesionMediumAll elements of a component operate on the same input or produce the same output
Sequential CohesionMediumThe output for one part of a component is the input to another part
Functional CohesionStrongEach part of a component is necessary for the execution of a single function
Object CohesionStrongEach operation provides functionality which allows object attributes to be modified or inspected