What is shotgun debugging?
Shotgun debugging refers to the process of making directionless changes to a program in the hopes of perturbing a bug out of existence. It rarely works; however, it may help to explore the dynamics of a buggy program when used by a domain expert.
For example, with shotgun debugging, a programmer may be able to understand the existence of a race condition in the code. If adding or removing print statements affects the program’s working, then the program may be stuck in a race condition. This might mean that when a print statement is added to a certain operation, the operation is delayed. This delay could sequence the general set of operations in a way that might “fix” the program.
Shotgun debugging is best used in small programs sa it does not lend itself well to increasing complexity.
Free Resources