Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
At some point you’ve probably experienced a problem in your code that you didn’t know how to solve. Here are 5 techniques you can use to get you going again (and be sure to watch the 1950s educational film inspired video version of this post).
1. Rubber Duck Debugging
The first thing to try when you get stuck on a coding problem is talk yourself through the problem again.
This technique tends to work well and is equivalent to those times when you ask someone for help but realize the solution while explaining the problem to them.
To save yourself embarrassment (and to let your coworkers keep working uninterrupted), people often substitute an inanimate object, like a rubber duck, instead of a coworker to try and work out the problem on their own.
2. Simplify the Problem
Breaking a problem down into smaller solvable parts can help sometimes.
Try breaking down long methods into multiple shorter ones, swap in simpler values for parameters, and try to just get a single use case working before attacking your entire problem set.
Often times making progress on a smaller section of your problematic code can get you going again.
3. Check the Internet
As great as the internet is, limit yourself to how much searching you do when troubleshooting. Searching for an online solution can quickly devolve into wasting two hours with nothing to show.
4. Ask a Friend
If you work through problems with others you’re probably amazed at how differently others approach a problem. Often times this leads to a solution you would not have thought of on your own.
Friends who are new to the problem area often have the most creative solutions due to not yet having become cynical and jaded from previous experience.
Try to hold off on this option until at least trying all of the above techniques because it’s rude to constantly interrupt another person’s concentration.
5. Take a Break
Sometimes you just need to take a break.
Whether it’s going out for a run at lunch or going home for the day, try doing something else for at least an hour and DON’T think about your coding problem while doing the other activity.
Often you will return to your problem later on with new ideas for possible solutions.
Watch this post as a video on my YouTube channel.
5 Techniques for Troubleshooting Your Code was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.