Cohesion
- •
- •
goal
- •
keep cohesion as high as possible — high cohesion means a module does one thing well
- •
- •
kinds of cohesion (ranked highest/best to lowest/worst)
- •
functional — different elements cooperate to achieve a single function ← best
- •
sequential — output from one element is input to the next
- •
communicational — all functions reference or update the same data structure
- •
procedural — all functions are part of a procedure requiring steps in sequence
- •
temporal — all functions must be executed in the same time span
- •
logical — all elements perform similar operations (e.g., all error-handling routines)
- •
coincidental — elements relate to each other very loosely, if at all ← worst
- •
- •
- •
- •