DEV Community

Sofia Jonsson
Sofia Jonsson

Posted on

5 Debugging Tips for Beginners

In the process of learning how to code, we inevitably run into problems. Some are easier to solve than others but sometimes you feel like you've coded your way into a corner and there's no hope in sight. We've all been there. Stuck in a deep, never-ending black hole of coding induced frustration. Too much? I'll tone it down.

As beginners, it is inevitable that we run into problems that we cannot solve, and the purpose of this blog post is to remind you to take a step back and attack it from a different angle. One thing that seems much easier than it actually is when you are learning is debugging and troubleshooting your own code. During the prep work for the Full Stack Boot Camp, I am attending I had no clue how to properly go about solving my code errors and wanted to write this post to help guide anyone else in their early stages of learning to code.

Alt Text

1. Read the error message

At the beginning of my coding journey, the error message looked like paragraphs of angry red mumbo jumbo, just begging to be skipped over. The error message is pretty intimidating at first, but once you get over the red text we have been conditioned to fear and hate, you'll see that its actually a very helpful nudge in the right direction. The error message will compare what it received and what is expected, in what file the error exists, and on what line the error is located.

Alt Text

2. Write it out..again

This goes for in and out of the server. Sometimes the errors are as small as extra space, symbol, improper capitalization, etc. within the code and writing out the same method below the one running the error can help you compare and contrast to find your mistake.
Most of the time the error is much larger and can be a result of improper use of a method. Keep the original code, but comment it out so you can refer back as you work your way through and implement changes.
For some of us, old habits die hard and we need to manually scribble it out on a piece of paper. Draw out the relationships, the key points, and the migrations. Whatever step you feel that you need to take to solidify key points- take them!
Alt Text

3. When in doubt, Google it out

Oh, our Lord and Savior, Google. The beautiful thing about programming is that we don't actually need to memorize how to do everything, just how to read it so that you can implement it. Chances are someone has already run into the same issue and posted a question to stackoverflow.com where others have contributed explanations and answers. This can still be tricky because everyone codes differently, and in different languages to make sure the language is the same and you understand what it is they are doing in their answer. If you can explain it, you can use it!
Alt Text

4. Walk away, get some fresh air

If you feel like you've worked your way in circles and feel the fatigue coming on, take a break. After staring at a computer screen for who knows how long the last thing your eyes need is another screen to "decompress". Go get some water, maybe eat a snack, but go step outside. Getting fresh air and sunshine on your skin does so much for your overall health. Inhaling fresh air enables you to breathe deeper and longer which increase the amount of oxygen transported to your body's cells. This increase in oxygen translates to greater energy and clarity of mind according to an article published by livestrong.com. You'll be ready to return and start thinking of a new approach.
Alt Text

5. Ask for help

Manage your time. If you find that you have been working on the same problem without progress and go through the previously mentioned steps, reach out. There are online communities through blogging platforms, stackoverflow.com, pythontutor.com, and so much more for those learning on their own.
Before you reach out, be sure that you can answer these three questions:

  1. What are you trying to do?
  2. What code is running the error?
  3. What have you tried to do to fix it?

Those who do have access to in-person help should absolutely use it. If they are in a teaching position the worst thing they can say is no, or point you in a vague direction to help you get to your next step.

It's easy to work your way into exhaustion. Take the steps necessary to increase your productivity and ask for help when you've run out of options.
Alt Text

What is your favorite beginner debugging method?

Reference:
https://www.livestrong.com/article/436651-the-effects-of-sunlight-fresh-air-on-the-body/

Top comments (0)