HACKER Q&A
📣 iosifnicolae2

How Do You Cope (As a Programmer) with Mental Fatigue?


How Do You Cope (As a Programmer) with Mental Fatigue?


  👤 ksaj Accepted Answer ✓
Stop thinking things like "this is a code smell" and "this might be totally clear, but it isn't y enough."

Overly critical thinking causes way more mental strain than necessary. Near constant pressure to conform with the latest book will of course cause burnout. Just write the flow you worked out in your head, because you already know it'll work before you even start typing.

Maybe programmers sometimes need to go off on a "not standard" bender once in a while to let their creative juices flow again. I'm pretty sure that's where the best code comes from anyway.


👤 GianFabien
You wouldn't go to the gym and pump iron for 8+ hours straight and do it every single day of the month. Consider that 20% of our glucose is consumed by our brain, so obviously it is working hard. It's just not obvious as for a more labor oriented profession.

My personal solutions include:

Going to the gym or playing a game of tennis at least once or twice a week. Yes, during the working day. I prefer to code at night anyway.

Taking an hour off for lunch, during which I go for a brisk walk and pay attention to my surroundings, etc. Not stew over the latest problem.

When I catch myself spinning my wheels over some problem. I get up, walk to another desk which has no screen, keyboard etc. Take a sheet of paper, write down what the problem is. Close my eyes and let my more relaxed brain come up with a solution. Write down the solution and then go back to the desk with the computers.

Obviously YMMV, but it is helpful to recognize that when mentally fatigued, you are working sub-optimally, so why beat yourself up. Just take a break and let your brain actually rest. BTW, sleep is natures way of forcing your brain to have time out.


👤 simonblack
If the Programming is a deadlined job, things might get difficult.

On the other hand, if there is no specific deadline for a specific piece of coding, it's best to walk away from that task and leave it for a while. That 'while' might be as little as a few minutes or as much as several weeks or months.

Generally, during that period, your mind is still working on the task in the background and sometimes almost 'out of the blue' the solution will present itself.

In any case the time spent away from the problem will wipe the slate clean enough so that you come back to the problem without the previous mindset and/or ideas that were your mental block. By starting afresh on the problem, you begin to look at it from another angle.


👤 WheelsAtLarge
Programmers have a tendency to carry around, in their mind, their last programing challenge. In some ways, it's like always being at work. I advice people to find a hobby. One That they can use to focus their mental energy away from programming. It can be anything but you have to be able to work on it and only it for a while. Your goal is not to make it an obsession but a way to relax. During the Olympics there was a diver that used crochet to relax in-between his dives as away to reduce the pressure of the competition. As a programmer you can do the same thing. But pick a hobby you truly enjoy.

👤 ge96
Might need to put "Ask HN:" in front.

Anyway for me I hope I can go to the park/do something none coding like a hardware project. TV/gaming. If none of the above binge eat and pass out (not great).


👤 burner556
I smoke loads of weed and drown my sorrows in alcohol. Adderall to get me started in the mornings. It’s not sustainable but i take 2 months off every year to prevent mental breakdown.

👤 32gbsd
I stop writing code.