Bugs and Errors are common in Software Development. It happens to the best of us. Using the below points will be helpful when you’re debugging your code.
Go through your code
Before you look at any logs or monitoring tools, go through the code that’s causing the error. If you read through the code, you’ll understand it and often times see what it is you’re doing wrong.
Look at the error logs
Use all available logs and monitoring tools. The more information you have, the better you’ll be able to understand the problem and resolve it. Modern Browsers, such as Google Chrome, also provide tools for developers to make use of.
Don’t develop Tunnel Vision
You don’t want to be sitting for hours, looking at the same line of code and blanking out. Take a step back, take a break, and tackle the issue with a fresh mind.
Ask for help
A second pair of eyes is always helpful, especially if you’ve developed tunnel vision. Someone else might be more experienced with the issue, or they can present other ideas you’ve not thought of. Even just thinking about the problem out loud could be helpful.
Use Source Control
Going through your latest git commits might will show you what’s changed. This is especially helpful with multiple people working on the same project, and it might show you what’s causing the issue. You can then Rollback the change or create a Hot Fix for it.
Google is your friend
If all else fails, search for your problem using Google or Stackoverflow. Your problem might not be new, and someone else might have already posted a solution to it.