Shotgun Surgery
Version 1.0.0 · Updated 2026-07-30
CORE DEFINITION
Shotgun surgery is a code smell in which one conceptually focused change requires coordinated small edits across many classes or modules, often because one responsibility is scattered. It is the opposite direction from divergent change, where one class changes for many different reasons. The name is a software-maintenance metaphor, not a medical procedure.
SCAFFOLDING EFFECT
Reduce cognitive load
Inspect change history for code repeatedly edited together and consider consolidating a shared responsibility. Multi-department approvals are an organizational analogy requiring separate analysis; necessary review procedures are not automatically architectural errors.
Anchor fast decisions
A responsibility scattered across locations forces maintainers to remember every coordinated edit; an omission can create inconsistency. Moving related behavior to an appropriate home reduces that coordination, aiming for cohesion rather than one class containing all code.
MINIMUM ACTION
In progress 0/1Practice this model in one real situation:
account_treeGenealogyexpand_more
menu_bookReferencesexpand_more
Source support: Explicit
- refactoring.guruhttps://refactoring.guru/smells/shotgun-surgeryverified
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS