DEV Community

Jimmy
Jimmy

Posted on

Coding Right Before Bed -- I Can't Do It

I was in junior high school and obsessed with Dance Dance revolution. If I went to bed directly after playing DDR, I'd shut my eyes and see arrows scrolling across the back of my eyelids. It was kinda cool, but annoying at the same time since I was trying to sleep.

alt text

Fast forward to college and I find myself in my dorm at 2:00 AM working on a take-home final.

The final's objective:
Take a buggy implementation of a Red Black Tree given by the professor and fix it.

alt text

It was late so I figured I'd call it a day and resume my work in the morning.

Didn't happen.

I could NOT fall asleep. I'd close my eyes but my brain wouldn't shut up. My mind kept going back to my code, recalling rules associated with Red Black Trees, mindlessly making up scenarios that had no solutions.

I ended up getting out of bed and working on it further. I even took Benadryl in hopes to get drowsy enough to sleep. I didn't make any progress despite spending a lot more time on it that evening.

So what was I suppose to do? After a few years of experience, I've noticed myself occasionally reliving this episode. I've discovered high correlation with not being able to sleep and coding into the late hours of the night. Solution: no coding within a few hours of going to bed.

I've become a true believer of winding down before bed. No coding. I try to avoid looking at screens in general and utilize blue light filters if possible. If I do end up playing my Nintendo Switch I'll play the zenful Stardew Valley instead of Splatoon 2 which tends to get me all riled up.

alt text

I still have restless nights occasionally, and a hard-to-find bug is quite capable of absorbing my mind's thoughts when I'm going to bed, but the more I try to unwind before going to sleep the better I'm able to.

This is my first post :)

Latest comments (4)

Collapse
 
leomeloxp profile image
Leo Melo

This is another variation of the Tetris effect.

I get it very often as well. My most recent one was because I spent hours listening to podcasts on 2x up until right before bed. Spent the whole night hearing snippets of the podcasts in 2x and dreaming about it FML ๐Ÿ˜ž

Collapse
 
laughlete profile image
Jimmy

Oh my goodness it was a name! the 'Tetris effect'. Thank you so much. :)

Collapse
 
patricktingen profile image
Patrick Tingen

Yeah, feel sorry for you, but I recognize this all too well.

I have no problem in surfing or watching yt movies until late, but I should not do anything that involves more than 2 brain cells after 20:00 o'clock otherwise my head keeps spinning in bed.

If I do end up in this situation, the only way to solve it is by reading a book or something to calm my head, but that'll wake up my partner, so that's not an option.

The advantage of having a sleepless night, is that you sleep very well the next day :)

Collapse
 
laughlete profile image
Jimmy

Haha, your optimism about sleeping better the next day makes me laugh.

I feel you. I try to stop coding at 8:00 as well. It's hard because I work full time, I hit the gym after work, but I'm working on my own project outside work, yet I can't work on it late. What to do, what to do...