Debugging & Asking for Help


Monday, 22 Oct 2018 Kudzai Nyandoro

What do you do when you get stuck or experience a bug in your program? One solution is to leave, then come back later, hoping the problem will magically go away by the time you get back, right? Not. I've tried that approach in the past and results have been disappointing. With a little more experience I learned that an ideal place to start is by reading the error message coming from the stack trace in my terminal.

This is a good place to start because many times the solution can be found here, in the stack trace. In most cases, the stack trace can tell you exactly where the error is coming from, together with the file name and you can even find out the exact line number to help you start the fun debugging process. There are many clues that can be found in reading the message from the stack trace in your terminal.

When you've identified the error message and now have a good idea about where the bug lies, the next step is to open the file(s) and inspect each line, looking for things like misspellings, misplaced periods, semicolons, question marks etc. After making several attempts, with no luck, visit your favorite search engine and paste in a portion of the error message and add the language or framework for better search results. If you're lucky you'll notice that you're not the first one to experience this problem and many who came before you found solutions and shared them online.

Stack Overflow is a good place to visit next if you are unable find any solutions in the first steps mentioned above. When you write up your issue on Stack Overflow it is helpful to the reader for you to clearly state the issue you're having, what you have done to try and resolve the issue on your own and the results you got from your failed attempts. This shows that you tried to resolve the problem on your own, hence, you're more likely to find someone who would be happy to respond to your request for help.

If your error message is long I'd suggest providing a link using a tool like Gist from something like GitHub. GitHub lets you create a Gist that can be formatted in Markdown and you can paste the stack trace from your terminal to the Gist then embed the link from the Gist into your request-for-help-text. GitHub's Gist is not the only tool available out in the wild, you might already have a tool in mind that you prefer to use.

Also, the Gist link might be long, so you can use a link shortener such as Bitly to shorten your link before sharing it in your request for help on Stack Overflow etc. There are several ways to debug and ask for help. This is what has helped me in most cases; reading the error message, trying to use the clues from the stack trace, searching for the error message online, then asking for help when all else fails. Debugging can be stressful and discouraging to the new developer, I have had times when I would totally abandon my project because I had no idea where else to look or ask for help. I hope this helps new and upcoming developers.