Two-word tip to solve any programming problem

Share:

Let me describe a situation and tell me if it sounds familiar:

You’re working on a project, an interesting project, one that challenges your ability as a programmer, you know, one of those that comes every blue moon.  You’re working your way through the project, making numerous accomplishments and feeling great!  Then, all of sudden, you encounter a bug/problem that isn’t trivial to solve, so you looked at it and tried your best to solve it. After digging through Stack Overflow, reading through documentation, and tried many many possible solutions, hours passed, and you are going nowhere! You’re stuck at where you were from the start,  At this point, you feel helpless, frustrated, and is ready to give up on it… however, your ego as a programmer won’t let you give up, “there has to be a solution” you thought, so you keep at it, staring at your screen, and before you know it, 2 more hours has passed.  Now your eyes are blood shut red, you’re feeling nauses, there seems to be a an omen dark clouds cover over your head, you tuned out all forms of communication from your co-workers and just wanted to solve this problem before the day is over.

frustrated programmer

The above situation is something almost every programmer had been through, it doesn’t happen often, but when it does, it made us question our choice of career.  I’ve been there, numerous times and they were not pleasant to go through.  Thankfully I have co-workers and mentors who were there to give me advice on how we can avoid such thing and how we can fix this behavior, I want to pass on this advice in two words:

“Go Outside”

What? How? I’m sorry to click-bait you with the title, but this advice single handed me helped me get out of the situation above.  Let me explain.  When you’re stuck in the mindset above, your brain will not be functionally optimally, you’re stuck in one way of approaching the issue and you’re going through an infinite loop, solutions do not magically appear that way. Here are the benefits of going outside:

  1. You get to breathe some fresh air, it’s important to get air flow and recirculation to your system
  2. You use your brain for something else besides staring at the screen, this promotes neurons to fire and connect differently, and most importantly, remind you that there’s a world outside of your monitor.
  3. Untangle the aformentioned infinite loop, this is the “break” statement of real life. Sometimes solutions will pop in your head in some of the most unexpected moments.  I PROMISE.

Bonus: if you have a coworker or friend who can walk with you and talk about the thing you’re stuck on (rubber duck programming), that’ll help too!

Every time I find myself in the situation above, I went outside, and took breaks, Sometimes I go as far as calling it a day (DO NOT THINK ABOUT THE PROBLEM AFTER) and come back the next day to look at the problem in a fresh perspective.  New solutions magically appear to help me through the hurdle, so next time you’re stuck, try it and let see how it works for you.

I’ll leave you with a quote from Oscar Godson:

One of the best programming skills you can have is knowing when to walk away for awhile.

Sometimes taking a vacation really helps recharge your mind

Comments Or Questions? Discuss In Our Discord

If you enjoyed this tutorial, make sure to subscribe to our Youtube Channel and follow us on Twitter @pentacodevids for latest updates!

More from PentaCode