Best practices followed for proper debugging from personal experience:
- Try to gather as much as you can that you can get of the error you can understand of.
- Understand the flow of the program first, and then assign proper break points at appropriate places.
- Try to isolate the cause of failure. Take it one by one, piece by piece.
- Try to verify as to if the fault isolation and rectification fixes the process as desired.
- Mocks, stubs, assertions could also help.
- See the dependency of the code on the other functions. If there is any overwriting action that’s happening.
- Try to include proper exception handlings and stack error traces, to be able to check which part of the code is breaking or malfunctioning.
- Once, you know that this is something because of this, ‘___’. Document as to how the code is behaving and how it is expected to.
- Report to the concerned team member or assign it as a task to them to fix it.