The art of troubleshooting

The art of troubleshooting

The art of troubleshooting

One day you’re chugging along on a problem and things are going great. You’ve harnessed the spirit of Csikszentmihalyi with incredible dexterity and before you know it, you’re waist deep in the highly sought after “flow” state. Code is just flowing from your fingers and thumbs as if they were 10 little magic wands casting spells on your keyboard. You wave at all the chumps still planning, thinking, and architecting behind you. Then all of the sudden something goes terribly wrong. The code you were pretty sure would theoretically work doesn’t actually work. Worse still, there’s no manner of sorcery nor magic wands at your keyboard, just little splatters of grease from your fingers still caked with the pizza rammed into your face about 10 lines of code ago.

You signed up for this. Welcome to software engineering. 

If you program for more than 10 minutes on anything more than the most trivial of tasks, you’ll reach that point. Repeatedly. The art is what comes next.

There’s all sorts of things that could have led you to this point. Speed, a glaring blindsight, not enough spiking/planning time, lack of mental organization, lack of familiarity with the language, framework, package, or  codebase, or just plain luck. Those are just the individual reasons. Perhaps there are organizational ones as well, such as tight deadlines, unrealistic expectations, discouragement of testing, or a culture of “we’re doing it live!”

Regardless of what got you to this point there is a way out. Here are some strategies from my own experience:

Manage emotions, stress, and frustration

These emotions are extremely important because they arise when something in your mind or your environment needs to change. Perhaps you’re attempting to solve the problem the same way, over and over again, as if you were trapped in an infinite for loop. Or you’re absorbing the chaos or pressure around you, with your supervisor breathing down your neck and his supervisor doing the same ad infinitum. In any case these emotions aren’t helping you solve the problem at hand.

Walk away

Sometimes the best thing to do is walk away and clear your head. Take a stroll around the block, get some coffee, or talk to a few coworkers. Spend a few minutes thinking about something else away from your computer. Often times even a few minutes is enough time to look at the problem from a different perspective. I can’t count the number of times I’ve gotten so wound up trying to solve a problem, getting tense, stressed out, worrying if I was going to be able to solve the problem only to walk away an hour later and have the solution come to me. Walking away is downright magical and I encourage you to do it the next time you’re feeling frustrated.

Understand the problem

Do you understand the problem you are trying to solve well enough to explain it to someone else? If not, start with that. This preliminary research will help you explain yourself better if you do need to ask somebody else for help later.

Solve the right problem

Sometimes you’re trying to solve a problem that doesn’t actually need to be solved. Sometimes the answer is finding the right solution and other times it’s finding the right problem. Start from the beginning with what you are trying to accomplish. Is there some other way to get there?

Start with evidence and observations

Hasty conclusions can create assumptions that sabotage your ability to solve the problem and steer you down endless rabbit holes that end up wasting time. Start with data and observations to fully understand what is happening. Challenge yourself to think of alternative explanations for your observations. 

Create a list of possible culprits

When things are broken and you don’t understand why, it can help to systematically narrow down what could be broken. Comment out whole sections of the code and slowly add parts back in until you discover the lines responsible for the error. Do you have a hunch? Comment that section out and see if the problem goes away.

Ask somebody for help

Once you can clearly articulate your observations and goal to somebody else, you are ready to ask for help. This is the last tip I thought of but certainly not the least important. There are times you just need another perspective.

Celebrate

Congratulations. You have successfully solved a problem without having a mental breakdown, tossing your computer/coworker out the window out the window, and ideally, are just a little wiser for the experience.

What do you do when you encounter a tough problem? Share them below!

Leave a Reply

Your email address will not be published. Required fields are marked *