If this is a human reading then you probably know what it’s like to be one.
There are days when everything is flowing exactly how it should, all the stars are fully aligned, you feel pumped up! But of course, the opposite is also true. Things sometimes don’t work out, the car has broken down, a volcano has just erupted!
Welcome to the rollercoaster called life!
Now your thinking, what does that even have to do with programming?
Successfully designing, building and deploying a computer program takes a lot of effort and time. It’s best to expect that things won’t always work out just like the way life doesn’t. There will be countless situations when the program, which used to be exciting to build, turns into a nightmare of being lost in a maze. The stack trace doesn’t want to give a helping hand and somehow the Stack Overflow servers are down.
You feel lost. And if you’re like me sometimes, you blame the emulator or the IDE. It’s not the code’s fault.
Being a great programmer demands extremely high levels of problem-solving skills. The amount you get paid in general is usually in direct proportion to your ability to solve some particular issue or problem efficiently and quickly. Here are six powerful ways to tap into that superhero ability.
- Take a well-deserved break
- Breathe, breathe and breathe some more
- Build a strong relationship with the debugger tool
- Get an additional set of eyes on the problem
- Become a bug reproducer
- Go back to the last functional version
1. Take a well-deserved break
This is probably one of the most effective ways. I don’t know exactly why it works but It does. A problem is best solved sometimes by leaving it alone. Applying more will or brainpower isn’t always the best approach and it can backfire on you with stress-related issues.
As soon as you relieve the butt cramps from sitting all day trying to solve the problem and go for a walk, the subconscious, like a background thread, is silently debugging that problem for you, automatically.
It doesn’t take long before an insight comes to the foreground which inevitably shatters any misconceptions or confusion that you previously had. Any syntax and logical errors you previously made are now completely obvious.
Take regular breaks and come back with a fresh perspective.
2. Breathe, Breathe and breathe some more!
Have you ever noticed that your breathing becomes progressively more shallow as you dig yourself more and more into the confusion rabbit hole? The tornado of work-related stress begins to consume you.
Well, it turns out that the way you breathe strongly affects the chemical and physiological activities in your body.
By breathing in more deeply, it helps us to tap into new resources of energy and focus. Forcefully inhaling more oxygen helps to rejuvenate and get the brain juices flowing. The Wim Hof breathing technique is an excellent tool for exactly that.
Something so simple but often overlooked right? Yet no one does it.
The first thing to do when faced with a scary production bug is to try to create room for yourself to work without pressure. This breathing technique can do exactly that. I challenge you to give it a try!
3. Build a strong bond with the debugger tool
A debugger is simply a tool you can use to stop the code at various breakpoints, identify and examine the state of the program at your own pace as well as many other things. Having said that, many software developers still don’t use it. Especially the ones with many years of experience, they may even render it useless or a complete waste of time trying to configure it.
A simple console.log(….;) should suffice. Or will it?
Nowadays, debuggers are so easy to set-up and use and there are a bunch of tutorials and guides on how to do it effectively. A debugger is like a set of keys for a supercar, helping you reach your destination quicker. Debugging is a skill in itself which employers are expecting you to be good at.
While the debugger is a powerful tool, it’s not a substitute for understanding the code. If you wish to find errors quicker, you must figure out exactly what your expectations are on the program and compare that to what the program is doing.
The truth is, developers will spend half of their programming time debugging. Doesn’t it, therefore, make sense to learn how to use the debugger and become good at it?
A good first step would be to learn all about your debugging environment, whether it’s Visual Studio or Android Studio.
4. Get an additional set of eyes on the problem
This one is quite obvious. Or is it?
The truth is, most of us have inflated egos which prevent us from seeking out help when we most need it. A part of you may resist the very idea of approaching your boss or a professional and disclosing the issue. This would imply that you aren’t capable of solving it yourself and people will look at you as useless. This identity you’ve constructed now, of figuring out everything yourself can end up harming you and the rest of the team.
I won’t tell you why you should ask for help, because that is obvious. However, I will let you know why not seeking help is potentially dangerous.
It calls your reputation into question
If you can’t be totally honest with the people around you, how can you expect to be treated professionally? When you don’t ask for help, not only is this jeopardizing your reputation but its also confirming to everyone else that you don’t know what you’re doing.
You alienate others
If you don’t communicate and express your opinions about a particular issue which your facing others may begin to perceive you as anti-social and not open to collaboration. Doing so creates a barrier between yourself and the people who are trying to reach you for guidance.
You close yourself off to additional opportunities for growth
Eventually, the big snowball of distrust and rampant dysfunction will cost you exciting and career-boosting opportunities. Not seeking the help of others will prevent you from receiving the golden nuggets of knowledge that the professionals can give you.
Put the ego aside, learn to ask quality questions and seek out opportunities to help others the same way others have helped you.
5. Become a bug reproducer
Bugs are deceptive and mysterious little creatures. As soon as you fix one, the second will creep in through the backdoor. This is quite normal. However, it becomes frustrating when the same bug keeps presenting itself over and over again and you can’t put a finger on exactly why it’s happening. Fixing it is only half the battle.
The solution is to reproduce the bug ourselves. That way we get a better understanding of the issue and verify that the bug has been fixed. Mindlessly stepping through code like a Zombie will only make the bug come back again. It is better to take an active approach and build a relationship with the bug. Learn about its characteristics and tendencies.
As a responsible developer that you are, your job is to take steps to recreate the issue and confirm that the same bug is being reproduced. Only then can you can take the necessary steps and procedures to prevent them from occurring again and assign it back to the QA team for testing.
Taking some extra time to verify that you have the right steps to reproduce an issue is crucial to preventing a bug being passed around between teams. Accurately recording the steps leading to a bug is an absolute must.
6. Go back to the last functional version
When everything else fails, go back to the last functional version.
The so-called “regression bug” is a new feature you have recently added to the program which has stopped functioning after the last system upgrade. Usually, bugs like these are more difficult to solve due to side effects from new unrelated functionality recently developed.
This is where version control such as Git can come to your rescue. (provided that you’re using one). Simply filter through your last commits and try to identify the problematic ones. Going over the history this way, it will help to identify and take care of suspected bugs. Use the blame annotation to figure out which co-worker or specific line ruined the project.
Encountering a bug is par for the course in your Software Development journey. Bug infestations are all too common and having the right tools to fix them is essential. You now have a new set of tools which you can add to you bug fixing repository.
With enough coding mastery, you will develop more clever ways of finding them. Your intuition will shine a light and expose them quicker. Until this happens though, expect a lot of frustration with the compiler as it spits out a bunch of exceptions.
If your having a really hard time with those seemingly “impossible” bugs, remember that there is always that smart person lurking around in the shadows who are willing to give you a helping hand, provided that you take initiative and seek to accept it. The choice is yours!
May the bugs leave you in peace. Happy coding.