Back to the 2025 paper

Module 3: Software Design & Metrics

20257m

Define coupling and cohesion in module design. Why is low coupling and high cohesion preferred?

Worked SolutionAI Assisted

Coupling and Cohesion in Module Design

Both are design-quality measures for the modules that make up a system.

Cohesion

Cohesion measures the degree to which the elements inside a single module belong together — how strongly the module's internal parts are related to a single purpose.

  • High cohesion (good): the module performs one well-defined logical task; all its elements contribute to that task. Easy to understand, test, and reuse.
  • Low cohesion (bad): a module does many unrelated things (e.g., a "utility" module mixing file I/O, math, and GUI code); hard to understand, test, and maintain.

Cohesion levels (best → worst):

  1. Functional cohesion — all elements contribute to one function (best).
  2. Sequential cohesion — output of one part feeds the next.
  3. Communicational cohesion — parts operate on the same data.
  4. Procedural cohesion — parts follow a process/sequence.
  5. Temporal cohesion — parts executed at the same time.
  6. Logical cohesion — parts are logically similar but unrelated (e.g., all error messages).
  7. Coincidental cohesion — parts have no meaningful relationship (worst).

Coupling

Coupling measures the degree of interdependence between different modules — how much one module depends on another.

  • Low coupling (good): modules are independent; changes in one module have little impact on others.
  • High coupling (bad): modules are tightly interwoven; a change in one ripples through many, making maintenance and testing hard.

Coupling levels (best → worst):

  1. Data coupling — modules share data via parameters (best).
  2. Stamp coupling — share a data structure (record) but only use part of it.
  3. Control coupling — one module passes control information (flags) to another.
  4. External coupling — share an externally imposed format/protocol.
  5. Common coupling — share global data.
  6. Content coupling — one module directly accesses/alters the internals of another (worst).

Why low coupling + high cohesion is preferred

  1. Maintainability — a change stays local: with high cohesion, the change belongs to one module; with low coupling, other modules are unaffected. This directly reduces maintenance cost and effort.
  2. Understandability — each module is a self-contained, single-purpose unit, easy to read.
  3. Reusability — cohesive, loosely coupled modules can be lifted out and reused in other systems.
  4. Testability — modules can be unit-tested in isolation; fewer inter-module interactions to cover.
  5. Reliability & reduced defect spread — errors are contained within a module instead of propagating.
  6. Parallel development — teams can develop modules concurrently with minimal coordination conflicts.
Idea Good Bad
Cohesion High (functional) Low (coincidental)
Coupling Low (data) High (content)

Summary: "high cohesion, low coupling" is a cornerstone design objective — it yields modules that are simple to build, test, maintain, and reuse.

Similar questions

Free AppAndroid App

Coursify Android App

Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.