
Ask HN: How to relax after coding for too many hours? - rsrsrs86
Hi, what do you do to relax and sleep after coding for many hours straight? I tend to get very agitated and can&#x27;t sleep well.
======
itamarst
Coding for too many hours straight isn't actually very productive. Take more
breaks while coding, and stop working after a decent number of hours: you'll
do better at coding and you won't be as exhausted at the end.

See [https://codewithoutrules.com/2016/08/18/productive-
programme...](https://codewithoutrules.com/2016/08/18/productive-programmer/)
for more.

------
cauterized
You probably haven't had enough physical exertion in your day to drain off
your energy, and your brain interprets mental focus as a sign that there's
something to be anxious about. Sure recipe for tons of nervous energy.

The suggestion to exercise to physical exhaustion is a good one. I usually
don't have to go that far, though. Even walking a couple miles usually takes
the edge off and gives the brain a chance to wander into other paths.

Doing something else that's almost entirely physically oriented can also help
- a craft project, cooking, etc.

------
fratlas
Strenuous exercise. Forces your brain to shift out of the coding context.

------
ASpring
Read easy genre fiction until you start nodding off into the book.

------
tjalfi
Take a walk, work out, or read fiction.

