This post is also available in Russian language at Softdroid
You're at your desk for the N-th hour straight. Typing is becoming a burden, and you're thinking whether your keyboard is the modern equivalent of Sisyphus's rock.
Coffee won't do it anymore. Plus, the magnesium levels in your body are so low that another cup of brown deliciousness might be the nail that drives you into an unproductive state of shaking and sweating profusely without putting out any code.
All efforts to rediscover the joy of programming are futile, as you use the last bit of your energy to push back the words that are creeping around your mind in all caps:
Tricky Nature of Programming
Even the best of us encounter unsolvable software engineering problems. When it happens, it doesn't necessarily mean that you're lacking skills or knowledge.
Programming isn't an easy job and it can take unorthodox methods to stay productive at the level that you wish to be, and to keep committing quality code.
When I spend hours on a problem and still can't find a solution, I end up feeling wasted. I don't mean drunk - more as "I never thought someone could get this tired".
There's no anger or sadness. It's just that I've tried everything and it still isn't working. I lose hope and get closer to resigning. I feel like switching jobs and becoming a bartender or something, where I wouldn't have to put hours of research and testing into pouring someone a beer.
These are the thoughts that run through my head as I rest from typing. I wonder about life, wonder about code, and wonder why my energy is so depleted.
Is this productive? Well, I've never heard any expert say that "resignation and malaise make great code", so probably not.
This raises the question: how do I escape this unproductive state?
Rediscover the Problem, Rediscover Your Productivity
I suppose you may already have your own process for doing this. In that case just carry on doing it, I'm probably not going to tell you anything new.
If you're new to coding, then I doubt that you already have a process for rediscovering your productivity.
The ideas that I will share should help you maintain your productivity while programming, in a healthy way and without burning out. Those ideas are:
- Test different solutions until it feels repetitive
- Look for open-source solutions online
- Ask programmers with more experience than you
- When all else fails, become Hercules Poirot
1 - Test different solutions until it feels repetitive
Before you start researching or asking other developers (=wasting their time), you should try to work out every solution that you can, using the knowledge and ideas you already have.
As obvious as it might seem, too many programmers start from asking others before they even sit down to analyse the problem themselves. Don't be one of them, don't waste other people's time.
Put in your work first, look for help later.
2 - Look for open-source code online
When you've put in the work and it hasn't led anywhere, your next step can be to try open-source code. A lot of coders build software for the fun of creating a solution and posting it online for everyone to use. Others post code they've used in commercial projects.
Solutions from these sites come in the form of reusable code that you can implement into your project.
Just remember that there is always a risk to using code developed by someone you don't know. It might change the behaviour of your program in unexpected ways. Back-up your original code and proceed with caution and common sense.
3 - Ask programmers with more experience than you
Have you ever asked someone for help, only to realise that you don't even know what you're asking about?
Before you ask anyone, you should prepare questions that you haven't been able to answer with online research.
Come with a well-defined problem, and you should get a well-defined solution. Come with a chaotic description of a problem that you don't understand yet - and you'll get a chaotic response (and probably annoy someone).
If you there aren't any developers around you that you could ask, look for them online. You can ask around on StackOverflow, or the MSDN Social Forums, or look for Slack channels specifically dedicated to the technology you're using.
Dig deep enough and you'll find more online communities that are full of helpful, and often very experienced programmers able to help you. For instance, you might want to join FreeCodeCamp. Even if you're already an experienced coder, you might find help in the FreeCodeCamp chatroom, which currently holds 44,853 people (checked on 04.05.2017).
4 - When all else fails, become Hercules Poirot
Whenever Hercule Poirot was working a case he would gather all necessary information, twist his fashionable mustache and... go to sleep. Or drink tea.
Seems like he was avoiding real work, right? That's where you're heavily mistaken.
He was letting his "little grey cells" do the work, instead of obsessing or worrying about a murder case that seems unsolvable.
Agatha Christie may have not been aware of just how big of a lesson she was giving us through making Hercules Poirot into a character with such unorthodox ideas about knowledge work.
That's because the hardest solutions often come when you're the most relaxed - and it's not literary fiction, but proven science. That's when your brain is working in "diffused" mode, not in "focused" mode - you can learn the difference in this article.
Overall the idea is to simply forget about the problem at hand, and let your conscious mind get absorbed by something different. Your subconscious mind will start connecting the dots and working towards that "a-ha" moment that you've been waiting for so long.
What can you do to help your brain work in diffused mode? Just relax:
- Go for a walk (ancient philosophers used to give lectures while walking, because they already realised that walking helps us think)
- Clean your office or apartment (and give yourself a reward once you're finished)
- Meet a friend, grab a coffee, talk gossip (if you're too focused on the problem, conversation with someone who's not a coder will surely help)
I maintain a sort of healthy balance between programming and the rest of my life thanks to the ideas that I've described.
Whether you're coding for the satisfaction, for the money or for a chance to change the world - programming shouldn't be the only thing you think about, because you'll go crazy.
If you've tried everything and still can't solve a problem, try to forget about it completely. The breakthrough idea might appear once your subconscious mind connects the right dots.