The first and foremost step in troubleshooting the code is to try and reproduce the issue. If the issue is in a different environment which is other than the development environment, the first step towards troubleshooting would be to reproduce the issue in the development environment first, unless it is not something environment-specific. Reproducing the issue in the local environment can sometimes be challenging. That is the first place where patience starts. One of the biggest advantages of reproducing the issue in the local environment is that we will be able to understand the issue very well and clearly prepare a problem statement for troubleshooting.
While doing the troubleshooting if we get distracted to something else, we will be able to easily come back to the problem if we are clear as to what we are looking in the code.
Sometimes reading a code can be an exhausting activity. For some projects, just to reproduce the issue and troubleshoot the issue, it can take several hours to set up the environment. That is why we need lots of patience to go through this process. If we get exhausted so much in just setting up the environment to troubleshoot, we will not be able to progress well with the troubleshooting and we might even get distracted and deviated. Every developer will need a high level of patience to understand the issue and find the root cause of the issue. If we lose our patience, we will not be able to do a deeper analysis instead we will end up showcasing something for the sake of closing the issue.
Getting back to the problem statement
While traveling through the code and understanding the code, there is a high possibility that one can get carried away by the other functionalities of the code or making assumptions based on the code. We have to be first clear about the issue. Having a clear problem statement in our hand can help with this. Due to a hectic review of the code, there is an easy possibility for distraction. If something like that happens, it is always good to read the problem statement again and getting back on track in identifying the issue.
Focusing only on the issue
While reviewing the code we might find 50 other things in the code that can be made better. We may not arrive at a solution for the current issue but instead, we will be able to find several ways to make the code better. That is where we have to be cautious and focus only on the current issue. If we come across areas where the code can be made better, we can make a note of it and have it as an item for the future but if we start fixing the other issues in the code while investigating or finding the root cause for the current issue, there is a high possibility of making new mistakes and end up in a loop again investigating or troubleshooting without any proper progress.
Troubleshooting is a skill that not everyone can easily get it every time. It can take several years of coding exposure to do an easy root cause analysis. But over the course of years with lots of troubleshooting experience, patience will also be something that will gradually happen to the individual.