Back to the 2021 paper

Module 3: Software Design & Metrics

20217m

Explain cohesion and coupling. How are the concepts of coupling and cohesion useful in arriving at good software design?

Worked SolutionAI Assisted

Solution

Cohesion

Definition: Measure of functional relatedness within a module. High cohesion is desired (elements belong together).

Types (best → worst):

  1. Functional - single function (e.g., compute salary) - BEST
  2. Sequential - output of one element is input to next
  3. Communicational - operates on same data
  4. Procedural - related by procedure sequence
  5. Temporal - related by time (initialization)
  6. Logical - logically related (e.g., all inputs)
  7. Coincidental - arbitrary grouping - WORST

Coupling

Definition: Measure of interdependence between modules. Low coupling desired.

Types (best → worst):

  1. Data - via parameters - BEST
  2. Stamp - via data structure
  3. Control - via control flag
  4. External - via external format
  5. Common - via global data
  6. Content - one modifies other - WORST

Usefulness in Good Design

  • High cohesion + Low coupling → Modules independent, reusable, testable, maintainable. Change in one does not ripple.
  • Reduces error propagation, improves understandability and modifiability (as Q33 explains: limited modification, reusable, reduced propagation → all of above).

Principle: Maximize cohesion, Minimize coupling.

Similar questions

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.