News for hackers. Stuff that matters.

Ask HN: When do you code?

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 | 42 points | on HN )
Re:Ask HN: When do you code? by cmos on Thursday January 22, 2009 @07:42PM (#445698)
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)

Re:Ask HN: When do you code? by okeumeni on Thursday January 22, 2009 @05:31PM (#445499)
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.
Re:Ask HN: When do you code? by pj on Friday January 23, 2009 @12:10AM (#445977)
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...

Re:Ask HN: When do you code? by okeumeni on Friday January 23, 2009 @01:07AM (#446055)
Thanks, I'm coding now I'll enjoy it later.
Re:Ask HN: When do you code? by akkartik on Thursday January 22, 2009 @06:49PM (#445627)
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.

Re:Ask HN: When do you code? by mlLK on Thursday January 22, 2009 @05:27PM (#445494)
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.
Re:Ask HN: When do you code? by zkarcher on Thursday January 22, 2009 @07:11PM (#445655)
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.

Re:Ask HN: When do you code? by moe on Thursday January 22, 2009 @09:29PM (#445819)
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...

Re:Ask HN: When do you code? by zkarcher on Friday January 23, 2009 @12:21AM (#445990)
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.

Re:Ask HN: When do you code? by pj on Thursday January 22, 2009 @07:22PM (#445669)
Yes, those kinds of mornings are great too!
Re:Ask HN: When do you code? by lallysingh on Friday January 23, 2009 @01:53AM (#446077)
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.

Re:Ask HN: When do you code? by jyothi on Thursday January 22, 2009 @10:01PM (#445849)
_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.

Re:Ask HN: When do you code? by quadhome on Thursday January 22, 2009 @07:10PM (#445653)
Github's punch card graph gave me insight on my hours.

http://github.com/quad/moxie/graphs/punch_card for example.

Re:Ask HN: When do you code? by niels on Friday January 23, 2009 @02:05AM (#446096)
Re:Ask HN: When do you code? by bprater on Thursday January 22, 2009 @04:40PM (#445427)
If I can isolate myself from distractions, I can code anytime.
Re:Ask HN: When do you code? by sabon on Friday January 23, 2009 @12:25PM (#446657)
Well, I think that the whole thread is all about that "if".
Re:Ask HN: When do you code? by swapspace on Thursday January 22, 2009 @06:13PM (#445560)
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.

Re:Ask HN: When do you code? by azanar on Thursday January 22, 2009 @07:13PM (#445659)
> 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.

Re:Ask HN: When do you code? by jeeringmole on Thursday January 22, 2009 @07:56PM (#445722)
"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)

Re:Ask HN: When do you code? by swapspace on Thursday January 22, 2009 @07:56PM (#445720)
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.
Re:Ask HN: When do you code? by LogicHoleFlaw on Thursday January 22, 2009 @11:44PM (#445948)
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.

Re:Ask HN: When do you code? by nirmal on Thursday January 22, 2009 @08:24PM (#445756)
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.

Re:Ask HN: When do you code? by semicon on Thursday January 22, 2009 @06:15PM (#445568)
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.
Re:Ask HN: When do you code? by alecthomas on Thursday January 22, 2009 @05:19PM (#445471)
10pm to 3am also, but I think it's just that there are no distractions.
Re:Ask HN: When do you code? by sam_in_nyc on Thursday January 22, 2009 @05:44PM (#445519)
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.
Re:Ask HN: When do you code? by euccastro on Thursday January 22, 2009 @10:18PM (#445867)
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

Re:Ask HN: When do you code? by rufius on Thursday January 22, 2009 @05:45PM (#445520)
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.

Re:Ask HN: When do you code? by froo on Friday January 23, 2009 @12:42AM (#446013)
Through trial and error I've figured out what times of the day I'm 'switched on' - for example, I'm not a morning person so I leave all the mindless stuff for mornings (answering emails etc).

My best time of day to code is around 2pm - 9pm actually, I find I get more done during those times. I find that I read better later in the evenings and that I'm more of a cheerful person from late mornings to early afternoon - which is when I do most of my phonecalls.

Re:Ask HN: When do you code? by leftnode on Thursday January 22, 2009 @05:19PM (#445473)
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.
Re:Ask HN: When do you code? by coryrc on Thursday January 22, 2009 @11:46PM (#445950)
From about 8AM to 11PM with meal breaks on the Empire Builder between Chicago and Seattle. Unfortunately, that's only four days a year for me. The lack of Internet is both a curse and a blessing. I can only do certain types of work without the Internet.

Normally, I work in the afternoon in my home office with no one around.

Re:Ask HN: When do you code? by tjr on Thursday January 22, 2009 @06:02PM (#445546)
Most preferably, 8pm - 2am or so, but I rarely actually get to spend those hours programming.
Re:Ask HN: When do you code? by travisjeffery on Thursday January 22, 2009 @10:10PM (#445860)
Typically either late at night or very early in the morning.

Few distractions/noise, plus you can't make noise yourself so you end up banging away at the keyboard for a while.

Re:Ask HN: When do you code? by flashgordon on Thursday January 22, 2009 @08:53PM (#445783)
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!)

Re:Ask HN: When do you code? by gregstoll on Thursday January 22, 2009 @05:21PM (#445480)
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.
Re:Ask HN: When do you code? by oscardelben on Friday January 23, 2009 @03:27AM (#446158)
I feel more productive in the morning and I use headphones to isolate myself from external world. I also turn off skype and other IM.
Re:Ask HN: When do you code? by johngunderman on Thursday January 22, 2009 @05:20PM (#445478)
My best hours are all the hours of night. 5-2ish. I just loose track of time and end up getting sooo much done.
Re:Ask HN: When do you code? by jparicka on Thursday January 22, 2009 @05:56PM (#445540)
10pm and 4am.
Re:Ask HN: When do you code? by dan_sim on Thursday January 22, 2009 @05:14PM (#445461)
Between 10am and noon. I can do it again around 3pm to 8pm (or later if I'm in the mood).
Re:Ask HN: When do you code? by noodle on Thursday January 22, 2009 @04:15PM (#445400)
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.

Re:Ask HN: When do you code? by safetytrick on Thursday January 22, 2009 @10:50PM (#445894)
I code when and only when I've completed reading every article on Hacker News.
Re:Ask HN: When do you code? by doogle on Thursday January 22, 2009 @06:26PM (#445590)
I code when I can, between meetings.

Offsite, it's when I can.

Re:Ask HN: When do you code? by vijayshankar on Thursday January 22, 2009 @05:38PM (#445510)
I code usually between 3pm to 8pm. Sometimes 10pm to 1am.
Re:Ask HN: When do you code? by chanux on Friday January 23, 2009 @11:24AM (#446539)
When I'm in the mood & have the boost.
Re:Ask HN: When do you code? by reg4c on Friday January 23, 2009 @05:00AM (#446219)
When I'm alive.
Re:Ask HN: When do you code? by known on Friday January 23, 2009 @03:45AM (#446167)
pj, how old are you?
Re:Ask HN: When do you code? by Allocator2008 on Thursday January 22, 2009 @05:25PM (#445490)
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.
Re:Ask HN: When do you code? by PStamatiou on Thursday January 22, 2009 @06:10PM (#445553)
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?

Re:Ask HN: When do you code? by IsaacSchlueter on Thursday January 22, 2009 @06:19PM (#445577)
(psst: Paul, I think he's referring to Office Space.)
Re:Ask HN: When do you code? by Xichekolas on Thursday January 22, 2009 @09:48PM (#445838)
(psst: whoosh!)
Re:Ask HN: When do you code? by doogle on Thursday January 22, 2009 @06:25PM (#445586)
....yeah, that's where both quotes are from....
Re:Ask HN: When do you code? by zain on Thursday January 22, 2009 @06:25PM (#445587)
So is Paul ;)
Re:Ask HN: When do you code? by IsaacSchlueter on Tuesday January 27, 2009 @03:24PM (#452659)
I fail it. It is Office Space.
Re:Ask HN: When do you code? by jjs on Thursday January 22, 2009 @08:41PM (#445774)
Re:Ask HN: When do you code? by mhartl on Thursday January 22, 2009 @06:02PM (#445547)
I believe you have my stapler.
Re:Ask HN: When do you code? by albertcardona on Thursday January 22, 2009 @07:50PM (#445712)
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].