Weapons for Debugging | The war against Bugs

Bugs must go! Ghana must go! (oops that was a mistake) Bugs must go! Bugs must go!

--

I’m sure most of us have experienced that moment of coding where you close your laptop for the day cause you can’t fix a bug, arrrgh. Next you are like where could I have gone wrong. One time I was so annoyed I made a quote about bugs ‘I wish I could pay for all the bugs I’ll ever encounter while coding, if it was expensive I’ll get a loan for it’, yeah it was that serious.

At some point in my code life it felt like one of the most important skill to be a good developer was your ability to debug so I became friends with the bugs. You know how they say your best friends can become your worst enemies? I finally got better with understanding bugs and debugging became one of my best friends in coding and I became it’s worst enemy.

So people here are a couple of tricks to get better at debugging;

Be patient enough to read and maybe understand error messages

At times error messages are very simple and explanatory enough to point you to the error spot. But sometimes they can also be in Gibberish or Hebrew. So here’s what I've noticed if it’s understandable good, if it’s in Gibberish read it most times some words will usually give a clue of the area affected.

an error message in Laravel

Google is your friend

To me this is like the Nuclear weapon of debugging, I usually resent to this when others don’t seem to offer any solution. It’s also awesome when your error message is in gibberish I’m like 😐 then I copy the thing and paste it on google 👐. This hardly fails, their’s a very high probability that you’ll find your error with a solution in a forum or StackOverflow… Someone out there might have had a identical bug in the past.

Using the console

This is a great tool for debugging JavaScript and any of its frameworks. I also enjoy the console because its error messages are usually easy to understand and it points you to the point where the error was made. Hence whenever you’re coding with anything js, angular, vuejs… and you get an error run🏃🏃🏃 to the console.

StackOverflow

Here’s another awesome medium to get solutions to bugs in your code. It’s an online platform with lots of programming questions and validated answers, you can also upload your questions and it will be answered in good time. Moreover your question might have been asked before so you’ll just search and get your answer. Although you might not get your answers immediately, I like the way people answer questions by explaining the solutions in a very detailed and easy to understand manner.

Online forums

There many developer forums out there I’ll suggest you get affiliated with whichever one is related to your language of choice. For Laravel people Laracasts is a good one etc.

Slack groups

I’ve found that people in slack groups are always willing and passionate about helping others with their bug issues. So feel free to share your code issues with the group. More so I’ll advice that you make it easy for those who want to help find a solution understand your problem, express the problem in an easy to understand manner and you can even add screenshots. I’ll recommend that you join DevCenter’s Square, I see it as my code-village it’s where I take all my issues to, you know how they always have a solution to any problem in the village.

Use Language Specific IDEs

They make your life easier. Apart from their impressive hint features some are designed to detect errors across different files in your project, cool isn't it, that’s what I’m talking about. I’ll recommend PHP Storm for laravel/PHP developers, PyCharm for python/Django developers, you can go online to find the IDEs best for whichever language you use.

debugging with PHP Storm and PyCharm

Sleep

Some people say sleep is always the best solution to some crazy bugs. In my honest opinion I hate it when the only solution at the moment might be to sleep. This is because I probably have to shut down my work for the day, lag behind on the timeline or be forced to work on something else. Moreover the truth is that sometimes the reason why we start having error in our code is because we are fatigued and you just need to sleep to regain some energy. Also some bugs are insane, sometimes after doing all you can to find a solution nothing seems to work. At this point it might not be a bad thing to sleep. No worries you’ll find a solution when you wake up.

Finally I’m sure there are many other ways or tricks to debug, please make sure to share it in the comments section. These bugs must not stand a chance in this war 🔧🔨🔥🐞.

--

--