Single Responsibility Principle (SRP)

Most get SRP wrong: it’s not “do one thing,” it’s “one reason to change” tied to one actor (stakeholder).

  • Definition: a module changes for exactly one actor’s needs.
  • Misread: “single task” → over-splitting or anemic design.
  • Heuristic: if two different people can request independent changes, split it.
  • DRY caution: don’t merge concerns just to remove duplication; small duplication is fine when reasons-to-change differ. See DRY.
  • Smells: business logic + persistence + presentation mixed; commits that change unrelated concerns together.
  • Tactics: identify actors, keep code cohesive per actor; align boundaries with ownership. See SOLID.

References