UMBC CS 201, Fall 06
Fall '06

CSEE | 201 | 201 F'06 | lectures | news | help


Cohesion is the degree of interrelatedness of internal parts. All of the elements of a component are directed towards and are essential for the same task, ("A function should do one thing, and only one thing"). We should try to MAXIMIZE Cohesion.

Degrees of Cohesion

How much cohesion?

Example of Coincidental Cohesion

All of the following in one module:

Example of Logical Cohesion

Display time and date on the screen Prompt user for user-id Look up user-id in USER list If found: Prompt for password Validate password Process course enrollment request Else if not found: do error processing

Example of Temporal Cohesion

Related only by the time they need to be done, i.e. at the beginning of the program Initialize two arrays Initialize several variables Seed the random number generator Print a greeting

Example of Functional Cohesion

Each in a separate module:

CSEE | 201 | 201 F'06 | lectures | news | help

Tuesday, 22-Aug-2006 07:14:13 EDT