There is interesting kind of bug that can happen in software that seems to chain to another spot after its fixed, I like to call this the wandering software bug. You fix it once and break another part of the application and requires you to fix the next one, which fixes that one but breaks the previous one, or even better (sarcastically) creates another bug. This is an interesting phenomenon in software, it’s almost like the program/software can’t digest the new changes, it will abrupt the flow.
The common solution to this problem is rearchitecting the software for the “wandering software bug”. This means starting from scratch sometimes. Not always a pleasant outcome, but sometimes necessary to find the root problem. All roads lead to the beginning in these cases, and it’s a struggle to dissect and wandering software bug from the initial error message. Software is architected pretty good now a days, so this doesn’t happen as often. Also, an experienced engineer can find code that can lead to these bugs and often avoid them.
Here is an example, you create a new string property in a class from a web service that doesn’t use an interface. However, this class happens to be depended on another part of the application, maybe another class library. Without the interface to implement the methods, methods referenced themselves. This goes against the single responsibility principle or interface segregation in some ways and creates tight coupling, which usually can be the case for initial error or bug. This is architectural problem, if the developer had used interfaces to call the methods that they may have needed they would not need to create references to another class for some methods so directly.
Also, you can run an application, and the bug appears because it’s missing a dependency or the other class library is not referenced properly. So begins the wild goose chase for the right dependency. IDEs are more sophisticated nowadays, but if the class is not labeled or named properly or was built with the loose coupling in mind this can become a wandering software bug, especially if you have many layers to application, classes that depend on a lot of other classes.
Overall, architecture, and proper design practices can avoid this type of bug or help pinpoint the issue more easily. The takeaway is to build with intention of the future things your application my chain to, so you don’t have search so many layers to find the “wandering software bug”.