Skip to content

Shotgun Surgery

Medium — good to knowArchitecture

ELI5 — The Vibe Check

Shotgun surgery is when one small change requires you to modify dozens of files across the codebase — like firing a shotgun and hitting everything. Want to rename a field? Good luck, it's referenced in 43 files, 12 services, and 3 databases. It's a sign your code is too tightly coupled and one of the most dreaded code smells.

Real Talk

Shotgun surgery is a code smell identified by Martin Fowler where a single logical change requires many small edits across multiple classes or modules. It indicates poor encapsulation and excessive coupling. The remedy typically involves consolidating related behavior using the Move Method or Move Field refactoring patterns.

When You'll Hear This

"Adding a new user field requires shotgun surgery — it touches every layer." / "If a change needs more than 5 files, you've got shotgun surgery."

Made with passive-aggressive love by manoga.digital. Powered by Claude.