Creating an app is hard work. A lot of encouraging articles will tell you it’s easy. I’m probably guilty of this.

It’s not. It’s really hard work. Trust me.

Coding is one of the only types of work where you can spend an entire day focused and working hard and actually come away in a worse state than you were before you started.

In fact, I find coding is one of the only types of work where you can spend an entire day focused and working hard and actually come away in a worse state than you were before you started. When I write, I always have more words on the page even after an unproductive day. When I code, I sometimes come away from a 12 hour stint with an app that now no longer works.

So how do you stay productive in these situations? What can you do to be more effective? Here are some tips that I find useful and which you might too.

1. Take a break

Often when building an app, you’ll find yourself running into a road block. You’ve added all the code and it all looks fine, but it just won’t run. You’ve read over it a hundred times. The debugger isn’t providing anything particularly helpful. You don’t know what to do.

Notice what you’re doing when you come up with the solution. It almost always happens when you get up to go to the toilet, or to make tea.

Maybe you read over it again, don’t find anything wrong, and then hit ‘build and run’ hoping that the problem will somehow have magically gone away. It hasn’t.

Then you do it again. Maybe you change a variable. Perhaps Android Studio doesn’t like that variable for some reason? Or you try changing the order of your code slightly. You can waste a long time testing and re-testing a program that remains frustratingly broken.

Notice what you’re doing when you come up with the solution. It almost always happens when you get up to go to the toilet, or to make tea.

You might think this has something to do with blood flow to the brain. It is more likely an example of the ‘doorway effect’. The doorway effect is a phenomenon often described in psychology and used to explain why we often go into a room, only to forget what we came in for. When we cross that threshold, the change in environment causes entirely different networks in our brain to fire. This effectively alters our mental state and that sudden cognitive shift makes it hard to remember what we were doing before we came in.

That same effect can be a positive thing when you’re banging your head against a wall. A quick change of environment can be enough to change the way you are approaching a problem and cause enough change in your brain patterns to help you gain a new insight or a change in perspective. Even if you don’t work out what the problem is (normally something super-simple), you might come back with a new way of approaching the problem. “Maybe if I delete that line and then see if it works…”

And this gives us another more general tip: take regular breaks!

2. Invest in the right hardware

This sounds really obvious, but you’d be surprised how many people I know are still trying to build complex apps with poor hardware. I was in the same category until last year, trying to test on a very outdated and well-loved Surface Pro 3. The Pro 3 is fine for running Android Studio, the problem comes when trying to test apps on the emulator which would slow everything to a complete halt.

Don’t just aim for adequate performance. Aim for the best possible experience you can afford. For instance, switching to a wider monitor can make life a lot easier by giving you more space to spread everything out and still be working from a reference snapped to the other side of the screen. A great keyboard can similarly improve your experience. I recommend a mechanical keyboard that will give you nice clacky-keys.

3. Plan ahead

This is something I love to do wherever possible when writing, and it is equally as beneficial for development.

I like to plan precisely how I’m going to tackle a problem before I sit down to tackle it. When writing, there are few things more painful than a blank page and the feeling of not knowing what you want to write. So instead of doing that, I make sure to draft an outline for my article in my head before I even get to that point. I know my introduction, my main point, my conclusion, even a few witty comments…

You can do the same with coding. If you know you’re going to be tackling a particular challenge, then you can think about how you’re going to do it while you’re washing the dishes or walking to work. You might just stumble upon that eureka moment when you least expect it!

Likewise, if you are going to be tackling a new coding challenge that requires additional knowledge, then you can similarly plan ahead by watching tutorials and reading explanations in your spare time. If I know I’m going to have to learn something new for a project tomorrow, then I’ll normally spend the evening watching tutorials while I’m cooking. Even if I don’t grasp it entirely without being able to sit down at an IDE and give it a try, I can at least gain an overview of the subject which helps a lot when it comes to the crunch.

4. Look after your brain AND your body

The stereotype of the programmer is of someone who drinks a ton of coffee and eats a ton of junk food. We should challenge at least one of those ideas.

That’s because junk food provides us with ‘empty calories’ which in turn impairs our ability to think clearly. It’s not a matter of using your brain or your body – improving one will improve the other. The nutrients we get from our diet contribute to everything from brain plasticity (helping us to learn new topics) to the production of neurotransmitters that aid productivity and help us to get into ‘flow states’. In short, if you want to do your best work, then you should be drinking smoothies and eating organic meat – not relying on chips and chocolate bars!

You could even go one step further and make like the rest of Silicon Valley (allegedly) and use nootropics. Nootropics are ‘smart drugs’ which help us to focus more. They range from the healthy and natural (magnesium threonate, choline, omega 3 fatty acid), to the more synthetic and legally dubious (modafinil, Adderall).

I’m not about to recommend you try the latter, as we just don’t know enough about them yet to know if they’re safe for long term use. As Tim Ferriss says, there’s ‘no such thing as a biological free lunch’. In nearly any case, boosting one neurotransmitter is going to result in trade-offs in other areas of your life and performance. But something like omega 3 fatty acid, or maybe a nootropic stack made from things like a little choline and some minerals surely can’t do any harm. Perhaps you’re partial to a Bulletproof Coffee?

But what about coffee? Caffeine and coding go together like two things that famously go together; but it might not always be a good idea. Caffeine works by attaching to your adenosine receptors. This blocks the action of that inhibitory molecule, which is a byproduct of the energy processes that occur in our brain cells. Normally, adenosine builds up during the day and makes us feel tired and groggy. When caffeine blocks the receptors however, that never happens and we instead feel awake and focused. This is why caffeine is perfect for first thing in the morning.

When you decrease the activity of adenosine and wake up your neurons, you tell your brain something important is happening – so it produces more dopamine and more cortisol. You become attentive and it’s much easier to become ‘wired in’.

The problem with that is we are actually at our most creative when we relax. Moreover, increasing dopamine may actually inhibit creativity (studies have found a negative correlation between D2 receptors in the thalamus and creativity).

Caffeine and coding go together like two things that famously go together

Some aspects of programming are certainly creative, or at least require creative problem solving. So, while I’m not telling you to avoid coffee (that would make me a massive hypocrite), just be aware that the more wired you are, the harder you may find it to see the solution that’s right under your nose. Again, timeouts are important.

If you really wanted to boost your mental performance for coding, then focus on training your working memory. This is what we use to store information that we’re working on, which becomes incredibly important when coding. The good news is that there are brain training exercises that can enhance this aspect of cognitive performance, including the Dual N-Back test and good ol’ chess.

5. Control your environment

Finally, consider your environment and your comfort when you’re developing apps. Music can help to immerse you more fully in what you’re doing or it can be highly distracting. Apparently, programming actually uses the language centers of your brain at least partially, so you should generally avoid music with lyrics where possible.

I personally find synthwave and electronic music to be a good fit because it suits the technological nature of what I’m doing – your mileage may vary. Matt Mullenweg – creator of WordPress – says he will purposefully listen to a single song on repeat when he is trying to focus (or use a very small playlist).

The idea behind this is that it will help you to sink into a ‘groove’ and a rhythm. I’ve also thought in the past there might be some desensitization going on here. Just as our brain will ‘tune out’ the repetitive ticking of a clock, perhaps it will also eventually tune out a repetitive song, essentially creating a kind of sensory deprivation and removing an entire sense’s worth of distractions.

(By the way, please let me know your favorite programming tracks in the comments below!)

Something similar also happens when we work in a coffee shop: the gentle murmur of other people chatting over coffee is too dense for us to make out interesting words and eventually the brain writes it off as ‘background noise’. There’s even a website dedicated to creating this sound effect, called ‘coffitivity’. White noise will do the same thing.

You should also aim to remove other distractions which of course means shutting out loud, abrupt noises and anything that is too visually stimulating. Likewise, think about your temperature and your comfort. Keep yourself well hydrated and well-fed. The aim is to maintain ‘homeostasis’ so that your body doesn’t think it has any pressing concerns like eating or warming up. By being comfortable, you allow the code you’re working on to become priority.

Closing comments

These are just some of the tips I’ve encountered during my own research. There are many more and what works for one person might not work for someone else. Share your tips in the comments down below, I look forward to reading them!