Shotgun Surgery
Although it might seem a bit violent at first, to me, the term seems also funny, to be honest; that’s why I really like it. Sometimes, I’ve heard it referred to as shooting a fly with a bazooka. It is, basically, the opposite of divergent change.
When you’re dealing with Shotgun Surgery, it means you must make a bunch of changes in your code base just to tackle seemingly simple tasks. Frequently, you’ll find yourself altering code that appears quite similar, either directly copy-pasted or with a similar purpose. The term refers to the work of a surgeon, which is done very precisely, with a scalpel, in the least invasive way possible. Now replace the image of the scalpel with a shotgun and... well, you get the idea.
There can be several examples or reasons that lead to Shotgun Surgery; let’s quickly go through some of them, so we can prevent the problem:
- Copy and paste: This is the first example that comes to mind; you...