Code Smell 66 - Shotgun Surgery

Code Smell 66 - Shotgun Surgery

Say it only once

Subscribe to my newsletter and never miss my upcoming articles

Listen to this article


  • Bad Responsibilities Assignments

  • Code Duplication

  • Maintainability

  • Single Responsibility Violation.

  • Copy-pasted code.


  1. Refactor

Sample Code



Some modern linters can detect repeated patterns (not just repeated code) and also while performing our code reviews we can easily detect this problem and ask for a refactor.


  • Code Duplication


Adding a new feature should be straightforward it our model maps 1:1 to real world and our responsibilities are in the correct places. We should be alert for small changes spanning in several classes.

More info


Photo by William Isted on Unsplash

Duplication is the primary enemy of a well-designed system.

Robert Martin

This article is part of the CodeSmell Series.

Share this