Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 15, 2019 12:06 pm GMT

7 Ways to Clear Your Head When Facing a Programming Problem

Everybody has encountered it, the programming problem that makes NO sense. This problem has no fix, it just cannot be done. Then all of a sudden, a moment of clarity, and tada! A major breakthrough! Rarely, if ever, does one accomplish this but continuously slamming their head against the problem.

Being gritty has its merits. Grit is what gets us through all kinds of tough problems in life when applied appropriately. Unfortunately, grit can also be an enemy to a programmer. We strive so hard to accomplish the task, to fix the problem, or close the issue that we neglect to keep our minds in optimal working condition.

Whether we know it or not we likely employed one of these techniques or something similar when dealing with a hard problem. When you are stuck it is important to get out of the programming head-space and do something different that will activate your mind and let your brain figure that lingering problem out for you. It is critical to provide the right environment, nutrition and get the blood flowing for your brain to be working its best.

I have experienced this many times throughout my programming career and all of these techniques have helped me at one point or another. Step away, get a clear mind, and come back to tackle the problem with some fresh energy.

Stop Working

The first step is to stop working. It seems counter-productive but there is rarely a problem where the more you work at it and the longer you stare at your screen the more likely you'll be to finish it.

Take a minute to stand-up, do some quick stretches. How long has it been since you've had a glass of water or gone to the restroom?

Are your eyes tired? Maybe stand-up, close them for a minute and concentrate on your breathing.

Go for a walk

Some of my best ideas come to me when I'm walking to and from work. Getting away from the computer, breathing fresh air and letting my brain work without distractions or a screen.

You don't even need to have a destination in mind. Talk a stroll around the neighborhood, head to the grocery store, or the local coffee shop. It doesn't matter where you are going just go somewhere.

Let your brain breathe for a bit and it'll start doing the hard work for you.

Vigorous exercise

If you've got a difficult problem on your hands then it is time to step it up and get the blood flowing.

Weightlifting, running, cycling or any other activity that gets the takes a lot of energy is a great way to get your mind off of the problem. The activity will help get rid of the stress, make you feel better and coincidentally you'll get the benefit of being in better shape.

The activity doesn't have to be an all-day event if you are tight on time. Take 10 minutes to do some jumping-jacks, push-ups, and sit-ups. Run around the block a few times or go do the backyard chore you've been putting off for weeks.

Nutrition

Eating right is important for having a healthy brain. Functioning at a high level is important for solving problems. If you are eating only chips and sodas then likely you'll be going through various peaks and troughs. Eat more balanced meals for more consistent energy levels throughout the day.

Even worse still is not eating at all. Getting wrapped up in a problem for hours and forgetting to eat is a surefire way to burnout and struggle with the problem and make no headway.

Make sure you are drinking plenty of water, eating well-balanced meals that aren't full of sugar. When you get stuck and struggle with the problem until 1:30PM it is time to step away grab lunch. Once you have eaten come back and attack the problem with new found energy and enthusiasm.

Minimal reproduction case

There is a reason that open-source repository maintainers ask for minimal reproduction cases. You are forced to think about the problem and reduce it to its most basic of components. By reducing the problem it makes it easier for you to see what is happening and where you've gone wrong.

This technique is most useful when the problem isn't clear or the landscape is too complex. Start breaking down the problem into a component, function, or even a single line that is giving you problems. From there work on building a narrower scope until the problem becomes clear.

Talk it out

Whenever I have a problem and want to discuss it with a colleague I always seem to get some clarity about the issue.

Why is this? I'm forced to start from the beginning. Explain the steps required to get to where I am. I have to think simply and critically about each individual step.

If you don't have any within earshot you can try "rubber-duck debugging." Do the same exercise but with some inanimate object. If that feels to awkward try explaining it to a non-technical person. Whether they understand or not you will be forced to explain the problem in simple terms in a straightforward way which may help illuminate the issue.

Sleep

Finally, sleep is the most important of these techniques. If you are tired, or groggy, you will not be working optimally. Staying up until 3AM working on a problem may feel productive but, likely, you are wasting your time.

Make sure you are getting the sleep required by your body whether that is 7, 8 or 9 hours a night. Get your sleep! And let your brain work while you are sleeping. The number of times I have left a problem unsolved and came back to it the next day and solved it quickly and better than if I stayed up working on it is staggering.

Conclusion

Hopefully, you will use some of these techniques the next time you run into a programming problem. And, these techniques will help you break through.

If you have other techniques you like to use or have feedback send me a message on Twitter


Original Link: https://dev.to/drewtownchi/7-ways-to-clear-your-head-when-facing-a-programming-problem-2pp4

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To