Ask HN: When do you code?

42 points by pj ↗ HN
I can't seem to get any code written during the day, just too hectic.

My favorite time to code is between about 10pm and 3am when the world is asleep and there are few interuptions.

So, question: When do you code? Extra Credit: What do you do to give yourself more time to code during other parts of the day?

55 comments

[ 5.2 ms ] story [ 129 ms ] thread
like you, i tend to get distracted, so i try and make it easy for myself to sit and go when the mood strikes.

i tend to be most focused around 10-noon and 7-midnight.

but then again, i have a circadian rhythm disorder.

If I can isolate myself from distractions, I can code anytime.
Well, I think that the whole thread is all about that "if".
Between 10am and noon. I can do it again around 3pm to 8pm (or later if I'm in the mood).
10pm to 3am also, but I think it's just that there are no distractions.
Both in the early evenings and early mornings. I have to work all day, so I'm up at about 430 to take care of my dogs and then I start coding before I have to leave for work at 7. Then I get home around 6, hang out with my wife and dogs for a bit, then we usually each get on a computer, she does her thing and I code till about 11 when we go to sleep. Works well, and I get a ton done.
My best hours are all the hours of night. 5-2ish. I just loose track of time and end up getting sooo much done.
My good zones are 2-5pm and 9-11pm. I try to fill the other parts of the work day with administrative stuff or studying existing code, when possible.
I get in around 9:30 and usually zone out for an hour in front of my computer, but it looks like I'm working. I then zone out for another hour after lunch too. In fact, in a given day, I'd say I do fifteen minutes, of real, actual work.
I believe you have my stapler.
Would you bear with me for just a second, please?

What if - and believe me this is a hypothetical - but what if you were offered some kind of a stock option equity sharing program. Would that do anything for you?

Ever since losing my job (3 months ago), moving back in with my parents, and returning to college to complete my degree, my sleep habits have been dramatically altered and would now describe myself as either a B-person or night owl. I get most of my work done from 10 pm to 4 am while maintaining/establishing freelance contacts from 2 pm to 4 pm.
I code when I feel the groove. I'm one of those people who code until I’m done with what I wanted to achieve or my head spins and I must stop.
Feel this groove: http://www.youtube.com/watch?v=yTBDsGzm1IU

My gf sent it to me a while back. It's a Swollen Members song called "Deep End" talking about rappers who like to work at night cuz "that's when the tracks come out right..."

Good song...

Thanks, I'm coding now I'll enjoy it later.
I code usually between 3pm to 8pm. Sometimes 10pm to 1am.
It goes in bursts, and depends how interesting the thing I'm working on is. My sleep schedule shifts a lot, (I think I was meant for a 25 hour day) so right now I work from 7pm to like 5am.
The circadian cycle that regulates sleep (amongst other things) has a 25-ish hour period for most people, in the absence of natural time signaling stimuli (i.e. sunlight and noise). In natural conditions, sunlight in the morning readjusts your body clock in roughly +/-15m increments.

Recent research points to a faster way to adjust your body clock:

http://news.ycombinator.com/item?id=199394

Being a student I've learned to pack it in between the classes as well as during some classes. However this semester I've managed to get myself a schedule where I have no classes on Tuesdays or Thursdays.

That said, I tend to get up and work out in the morning and if its Tue/Thu then I'm coding till lunch, coding till dinner, then on and off in the evening unless the g/f objects. MWF its just whenever I get time. In between classes and so on. Sat & Sun is hit or miss. Just depends on my plans.

Most preferably, 8pm - 2am or so, but I rarely actually get to spend those hours programming.
Same here. Between 11pm - 4am. I'm not sure why, but I just feel much less distracted at night. Maybe it's the feeling that it's calm everywhere or maybe because daytime at office, with low cubicles, is full of noise and movement. Even with my noise-canceling headphones, I can never escape the feeling of movement and noise around me.

Sometimes, I sneak into an empty conference room when I've to really focus during the day.

> Even with my noise-canceling headphones, I can never escape the feeling of movement and noise around me.

If you are anything like me, the root cause may not be the noise and movement. It may instead be the anticipation that the noise and movement is someone who is about to pull you out of your flow. Even if it doesn't happen that often, the psychological jolt that occurs every time it does is enough to make my mind resist concentrating when potential distractions are around. Noise-canceling headphones do nothing against a tap on the shoulder.

Ya, I think that's what I fear as well. I get into a sort of tunnel vision when I'm focused. Some of my colleagues have mentioned that they have stood at my side for a minute or so(I have a slight reputation ;) ) and I don't feel that there is anybody there. When they finally do tap, it's all the more jarring.
I'm well known for jumping about a foot in the air when tapped on the shoulder. I despise workspaces where people can walk in behind me. (Hello cubicle!) When I'm in the flow though...

Aggh, I'm getting paranoid just thinking about someone walking in behind me now. Working when nobody else is around and no phones can ring is the best kind of work.

"The mere possibility of being interrupted deters hackers from starting hard projects. This is why they tend to work late at night, and why it's next to impossible to write great software in a cubicle (except late at night)."

From, you guessed it, Paul Graham... (Specifically, footnote #1 of chapter 6 of Hackers and Painters, aka "How to Make Wealth" http://www.paulgraham.com/wealth.html#f1n)

I get to work around 10:00am, but actually start coding at around 5pm and code for about 2 hours and accomplish more than I did from 10-5. I feel like all these people around me are just trying to cause some kinda intelligence vacuum.
I code when I can, between meetings.

Offsite, it's when I can.

Rather surprisingly, my most productive time is the 2.5 hours commuting on caltrain everyday. No internet access, nobody around from work or home = no distractions. It's been 4 months at this job, so it's unlikely to just be a honeymoon period (knock on wood)

I feel cheated on the days I accidentally get on an express.

This would be impossible if I was still hacking in C/C++ like a year ago. Then, it would take me 2 hours just to get in the zone. Hacking sessions less than 4 hours were simply useless. Now my unit tests make the zone super-easy to find. It's been the biggest epiphany of 2008.

Interesting thread. My best hours are late at night, when the world is quiet, and there are no distractions.

But... Recently I discovered that this also works if I rise early, _very_ early. This month, I've been waking up at 3am and accomplishing a LOT, until about 10am, when the outside world comes alive. It's nice because my mind is sharp -- I get to wake up and do something I love. I'm not racing against the urge to fall asleep, like when I code at the end of my day.

The downside is that I go to bed at 6pm every night... But apart from that, I really like this sleep cycle.

Yes, those kinds of mornings are great too!
Yeah, same here. During the day I usually only get small things done, if at all. Only after 10pm, sometimes closer to midnight, I really manage to zero in on a task and work it through. Most of the time I'm either done or get tired at around 4am. Sometimes I'll churn through till 9am without even noticing.

This style of work tends to occassionally push my sleep cycle around in funny ways. After intensive "sprints" it's not uncommon for me to have a week where I wake up at 6pm in the evening. That seems to be my recovery mode then, I don't get anything done in these weeks.

But sometimes, towards the end of such a recovery week, I notice the same thing that you mention. As I slowly adjust my cycle back towards the accepted norm there is often a period where I get up between 2-4am and many of these days have turned out amazingly productive, too.

Sometimes I wish I could just sustain either one of these rhythms (either getting up very early or getting up midday and working late) but for some reason I'm always slipping towards the "recovery state" after a few weeks. I guess that's my body's way of telling me when to stop...

That's exactly how I discovered the über-early cycle... I stayed up later and later, one day 8am arrived and I wasn't even slightly tired. I knew I couldn't sustain that sleep cycle (waking at 4pm feels grim) so I pushed my sleep cycle forward, living 26-hour days.

I'm drifting forward (woke up at 7am today), I may be cursed with an inability to sustain a healthy rhythm at one specific time. Not sure yet.

_very_early mornings have worked for me too on all critical work. One has to experience the 4 am bliss to appreciate it.

When I have company I do end up working late night.

Ditto. But, I have to point out that what also works is a good morning run for me.

Run before work. It's like 3 hours of regular brain bootup/procrastination are all taken away by that run.

I am most productive after feeding my damm cat's. After gorging themselves on diet cat food one falls asleep on my lap, and the other just to the left of my laptop, usually on top of my phone, which is always set to vibrate.

That gives me a few hours of productivity, then when they wake up begging for more food way before dinner so I kick them outside for a couple hours so they realize that life isn't all that easy, and sometimes it's a bit tough, because I'm busting my ass to keep them living what appears to me to be the perfect life. (except for the fact that they have no balls)

I code my best between 6 and 8 AM.

The world is asleep, the morning starts to pop up, I am totally relaxed and restored after a good night sleep.

Full brain speed, no distractions: greatest time.

The rest of the day is to run tests, write documentation and polish something here and there. [And to sleep: I usually take a nap between 8 and 9 AM, before getting out of home].

Right now I'm going through quals so...

I come into work at around 9. Sit away from the rest of my lab and code until my battery dies. Then I let my macbook fully recharge while I try to get through as much of my reading as possible.

Rinse and repeat.

actually one of the best times i find is between 4 and 8 before going to work!!! (problem is during my luckiest days i wake up no earlier than 5)...

the world IS quiet, you are just fresh from a good sleep (even if it is only 4-5 hours) and man the zone is like there never before... ofcourse if you are NOT a morning person then it wont be for you (lucky for me, i can be a morning or a night person when necessary!)