Hacker News new | ask | show | jobs
by steven_h 5682 days ago
I don't know, I work at my university as a mobile software engineer and I have trouble going to sleep at night as well.

It's hard to think about a million different problems a day and how to solve them then just cut all that off at 10-11 or so each night.

It probably doesn't help that coding is my hobby as well as my profession, so it really doesn't ever get turned off.

5 comments

2 things that in combination completely eliminate sleep issues for me:

- f.lux (time of day dependent display colour temperature)

- physical exercise

If I drop either for more than a few days, I'm back in insomnia land. If I exercised every single day, I'm sure I wouldn't need f.lux. Unfortunately, exercise takes quite a bit of willpower in winter (no nearby gyms).

I wonder if there's correlation between below-average physical activity and insomnia? I assume that a lot of coders---by necessity of their task and the tools they use---spend most of a week sitting as opposed to, say, a mail carrier or store clerk. Given that we're a species that evolved to leverage mobility for our survival, it's not a stretch to imagine that our bodies developed a dependency on lactic acid buildup and other "fatigue toxins" as one of the signals that sleepytime is at hand.

Has anyone done this study? It seems like a pretty straightforward study to do if some grad student out there is looking for a paper.

It's a recurring topic on HN. There seems to be plenty of anecdotal evidence for it.
f.lux is really great, it helped me a lot as well.
Same here. I've been using f.lux for the past month or so, it seems to help with getting back to a 'normal' sleep schedule. I mostly wanted to start sleeping earlier so that I would get more daylight during the winter.
It's not just that it is hard to turn off your mind, it's that I find it extremely tempting to get up and actually code up a solution to the problem that's on my mind instead of staying in bed. Thinking "It'll just take 10 minutes & then I'll go back to bed." is a very bad habit to develop.
Just write your thoughts on a piece of paper. Perhaps that won't draw you into staying up longer and longer.
I've learned over the years that if I come up with something useful as I try to fall asleep, instead of hopping out of bed, I just consciously save it for the morning. It's like waking up with a gift. And often the brain has done some useful offline optimizing.

To shut down the problem-solving machinery I usually fantasize about being starting point guard for the Lakers. May sound silly for a grown man, but it works for me.

Have you tried to cut coffee and take tea instead? Cutting alcohol in the week may also help you sleeping better. Doing a small jogging also helps losing some energy and can facilitate sleep.

Concerning your point, from your comment it seems like you are still young. At some point, you'll have to find a more sustainable pace. Most engineers I know have a family to support, like to do their job well, and thus need to have an overall good life hygiene.

Night owl coder here. It comes with the job I think, our job is creative and our minds toy with us to no end.

I have found I can "cut off" the deep thoughts by writing them down. I keep a notebook next to my bed and if I can't fall asleep because of something I want to program, I will write out everything about it in the notebook. After that, I'm far more relaxed because I am not worried about losing the knowledge once I fall asleep.