Shotgun Surgery
noun
say it: “SHOT-gun SUR-jer-ee” /ˈʃɑtɡən ˈsɜrdʒəri/
A code smell where one small change needs many small edits spread across many files.
What is shotgun surgery?
Shotgun surgery is a code smell: one small change, such as a $10 student discount, needs small edits in many different files, and the one that's missed shows a wrong answer. It means one rule is spread across the code instead of living in one place. The cure gathers the rule into one home, by moving the methods that use it or putting one front on them.
In a sentence
- “Adding the student discount was shotgun surgery: five files, one line each, and one was missed.”
Level: Journeyman · More Software Development terms at this level
Updated