How to switch off after a long coding session

Anyone who's ever done any coding knows that it requires a huge amount of concentration. This also means that even if you're using the best laptops for programming and as many web design tools as possible in order to automate or speed up processes, you may still find it hard to switch off after a long coding session. 

To find out how you can relax your brain and get to sleep after an intense coding session, we spoke to web designers and developers to see how they do it.

01. Get some exercise

"One of the challenges I have is switching my brain off, either so I can relax or switch gears and work on something new," says experience design strategist at Rochelle Dancel. "So it’s always good to get the blood going again. I took up bouldering [a form of rock climbing] a couple of years ago; I love it because my brain and my muscles have to be in perfect harmony or I’ll literally fall off the wall. I’m not very good at it but it’s the perfect reset button for me. It’s also a great way to spend time with your team that doesn’t involve alcohol."

02. Work on a different creative project

"It’s always difficult to unwind after a code sprint," says front end developer at 50,000ft, Anthony Miroballi. "I usually work on a creative project in a field outside of coding. For me, that’s electronics, video editing or designing 3D models for printing. This helps my brain shake off the stress while leaving me with another thing to feel accomplished on. 

The secondary effect is to prevent stress build-up from getting behind on other projects. After this process, I will usually be ready for bed or a quick nap before starting the next sprint."

03. Don't finish the day mid-task

"It can take some hours to snap out of the concentration required for long coding sessions, particularly if you’ve had to leave a problem unsolved or a task unfinished," explains Tim Whitlock, maker of Loco. "It’s not uncommon for me to watch a two-hour film while still thinking about code the whole time. Because of this, I make sure I finish work at least three hours before sleeping but most importantly, I try to finish the day at a satisfactory point. The latter can sometimes be difficult to plan but I find that avoiding new tasks in the late afternoon can really help. If you need to start something big and it’s past 3pm, simply save it for the next day and tackle something smaller or easier instead.

04. Use a sleep sounds app

"When I became a freelance web developer, I promised myself I would keep sensible hours. If I am honest, I still keep longer hours than I should," says Leonie Winson, a freelance web developer for Line and Form. "This results in too many nights awake and thinking very loudly. To relax, I use a sleep sounds app. My favourite ones are river sounds. The knack is to find a sound you can concentrate on. It can’t be too fast and you have to get the volume right. I set my timer for 40 minutes, concentrate on the sound and 95 per cent of the time I’m asleep before the sounds stop."

05. Write down your thoughts

"The evening after finishing a strenuous coding deliverable, your mind is still racing, thinking about code optimisation, best practices and design patterns," says Demetrios Kontizas, director of web development technology at Mirum

"You lie awake in bed or toss and turn, despite being mentally exhausted. Even if you are able to get some rest, often it’s the case that you struggle to stay asleep. So my strategy is simply to write things down. I feel as though having a brain dump of the code utilised on the project – even if it’s a high level sketch of the design pattern – helps to release the code from my conscious mind and therefore enables me to get a good night’s rest."

06. Embrace your creative time

"It’s hard for me to fall asleep after coding during the day. The catch, though, is my brain feels the most relaxed, creative and free during that 30 minutes or hour it takes me to fall asleep," says Jay Ainsworth, junior developer at FINE.

"In terms of mental stimulation and satisfaction, it’s my favourite time because it feels like a rare opportunity to analyse the thoughts my brain subconsciously has throughout the day. The only downside is that I end up lying there trying to decide if any of the potential solutions to code challenges are worth getting out of bed for.

This article was originally published in net, the world's best-selling magazine for web designers and developers. Buy issue 311 or subscribe to net here.

Read more:

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

net staff

net was a leading magazine for web designers and web developers, which was published between 1994 and 2020. It covered all areas of web development, including UX and UI design, frameworks, coding and much more. Much of its content lives on in Creative Bloq. View the net archive on Creative Bloq.