top | item 8946451

Ask HN: Tricks to integrate late coding session in current workflow?

24 points| KohgnaK | 11 years ago | reply

Hi everyone,

We're under quite a lot of pressure lately to finish a project by the end of Feb. Probably like a lot of you guys, I'm at best when I'm "in the flow" which often leads me to code till 3 am - 4am.

The problem is that if in my early twenties I used to be able to recover over only a few hours sleep for the next day, it seems like it is impossible for me right now (early 30's).

1/ Do you have any tricks or tips to ease the recover and have a somehow normal day after a late coding session?

I know that this approach while somehow good for work purposes is disastrous for health on the long run so:

2/ What tricks/tips do you use during your working day to minimize interruptions (so you could go at least 1/2 way "in the flow") ?

Cheers!

27 comments

order
[+] i0nutzb|11 years ago|reply
As an early 30's myself, I can suggest couple of few things:

- aim to at least 6-7 hours of (continuous) sleep in 24 hours. Don't rely on the fact that you will sleep more in weekends (you won't, and even if you do, the body doesn't work this way) - try power naps: in the middle of the day, take an espresso shot then go in bed and try to sleep for maximum of 20 minutes. The caffeine will kick just when you wake up; 20 minutes is usually less than you need to go to deep sleep (so you won't wake up cranky, dizzy or whatever). Even if you don't actually sleep, you will relax for 20 minutes :)

http://io9.com/the-secrets-of-highly-efficient-napping-16809...

As for interruptions: turn off your internet connection and put your phone to airplane mode. I strongly doubt that you will have _anything_ to distract you anymore!

[+] SyneRyder|11 years ago|reply
On the power naps: I highly recommend the iPhone app Pzizz Energizer[1]. The website makes it sound incredibly corny (meditative new age music, voice suggestion, binaural beats) but I find it knocks me out like a light & reliably wakes me up at the end of a 22 minute power nap. It seems to become more effective the more you use it, the audio becomes a cue to enter sleep mode.

Apparently it's now free (I originally paid $10 in 2010). There is an Android app as well, but sadly it's broken on my Nexus 5 (audio cuts out after about 3 minutes) and I dearly wish the developers would fix it, because the iPhone app has been so valuable to me.

(Mid 30s dev here who also prefers to work through the night, helped by very understanding clients.)

[1] http://pzizz.com/

[+] drig|11 years ago|reply
Let me turn this question around a little. I'm a manager of a software development department. I have a coder who works best at night. I got upset with him for falling asleep at his desk. Not once, but many times. He tells me "I'm up all night working".

To make this situation worse, our office is very over-crowded. It's hard for me to see how anyone gets anything done.

But, we have meetings the devs need to be at. Project scoping, standups with the stakeholders, etc. Plus, major architecture decisions are made in person. So, we have a pretty strict "work from home only twice per week" rule.

How do I let this developer work when he is at his best, without excluding him from critical decisions? And, how do I encourage him to work at his best, without encouraging the lower-performing members to see it as an opportunity to slack off?

[+] drewcrawford|11 years ago|reply
I manage people, am managed, and work strange hours.

In the scenario you describe, you have set of inconsistent requirements:

1. A developer that works strange hours

2. A need to get everybody in the same room

3. The "perception problem", a.k.a. snide remarks from the peanut gallery.

The first thing to do is to be a good technical manager and admit that you do, in fact, have inconsistent requirements. Something on this list must change. You cannot satisfy all three.

The next thing to look at is what is the best (or least-bad) requirement to change.

The simplest option is to fire the developer. I don't actually recommend that, but it is simple. Embedded in that statement is the implicit assumption that you will never again hire someone who works odd hours, and in my admittedly biased experience, people who work odd hours tend to be good, so there is a hidden cost to that scenario.

A more complicated option is to figure out how to eliminate or reduce your dependence on in-person meetings. For example, having discussions via email or on GitHub. I would probably argue that if your software developers are having meetings more than 0.5 times per day, they are not being productive to start with, so there are reasons independent of this particular developer to study that problem. For more on this strategy, I would recommend looking at the GitHub model. [1]

Finally, to address the third issue, you need a performance review mechanism that isn't attendance-based. For example, consider mechanisms that are feature-based or deliverable-based. Attendance-based performance is bad for a lot of reasons independent of any particular developer's situation--it motivates working hard instead of working smart, and so on.

The thing to see here is that you're either going to have to change the environment or the developers you place in it. Personally, I would recommend the former, but in any case, something's going to move. The advantage of changing something now is that you get to decide what to change. If you let the situation run its course, it will change in a manner and at a time that will be less convenient.

[1] http://zachholman.com/posts/how-github-works-asynchronous/

[+] anon4|11 years ago|reply
From my experience for meetings with the higher ups you only need to include the chief architect/project leader who can give you a bird's eye view. That person probably doesn't do much coding himself.

From there, have him communicate with the rest of the team on what to do - he should be able to do it via group chatrooms, conference skype calls and emails. I'm sure there is a time that's convenient for literally everybody to meet, even if not everyone will be meeting in person.

[+] zellyn|11 years ago|reply
Hope your developer doesn't realize there are places he could work that won't care what hours he keeps?

Seems like (a) if you focus on results rather than appearances, there won't be a problem with lower-performing members getting the wrong idea, and (b) sounds like you have a lot of meetings: are they really all as necessary as you think they are?

[+] jnbiche|11 years ago|reply
Is he a very productive developer? One of your best?
[+] vkr|11 years ago|reply
Here's what works for me:

1/

  - Intense workouts early in the day
  - A lot of water
  - Sunlight
2/

  - Airplane mode
  - Batching email, IM, SMS, ..
  - Automate payments
  - It's ok to be late with administration sometimes
Books that really helped me:

  - The 4-Hour Workweek by Tim Ferriss [1]
  - Getting Things Done by David Allen [2]
  - Rework by Jason Fried [3]
[1] http://amzn.com/0307465357 [2] http://amzn.com/0142000280 [3] http://amzn.com/0307463745

edit: added Rework

[+] zamalek|11 years ago|reply
> Intense workouts early in the day

Solid advice. Your body learns from your habits and exercise is a great way to teach it when it needs to be awake.

Another trick is regularized sleeping patterns. I had sleeping issues when I was a teenager and had some "soft" sleeping therapy. The most important thing I learned is: don't aim for a certain amount of hours, aim for specific times. E.g. Go to bed at midnight sharp and wake up at 7AM, come hell or high water. If you do stay up late, wake up at your usual time so as to not throw your clock off any more than it already has been.

Finally, if you are sleep deprived you are stupid. You're doing everyone a disservice by being that "hero" that pulls an all-nighter. Get your regular sleep and carry on with the task tomorrow: you'll finish it faster and do a better job of it.

[+] peteretep|11 years ago|reply
I have a lot of flexibility over my time, unlike the OP, but I've found shifting my workouts to 3pm has been much better than 6am, which is when I used to do them. I tend to now start work at 6am, run out of steam around 1pm, have some downtime, gym from 3pm to 5pm, and then I'm either in good form to see some friends or do some side projects... I had always assumed early morning worked best for me, until I tried something else.

+1 for GTD, too

[+] yourad_io|11 years ago|reply
> The problem is that if in my early twenties I used to be able to recover over only a few hours sleep for the next day, it seems like it is impossible for me right now (early 30's).

Tell me about it. I'm 30 and I'm shocked at how drastically this has changed. I recently slept for 26 hours at the back end of a largely sleepless week. Twenty. Six. Hours.

Needless to say, I'm taking it a bit easier on myself since then.

[+] MalcolmDiggs|11 years ago|reply
Ha! I'm picturing a guy rolling out of bed, looking at the alarm clock like: "Oh wow, I feel so rested after only 2 hours...no...wait...how is it Sunday?"
[+] woah|11 years ago|reply
I never had the ability to function without sleep, so as I approach 30, I guess that's one less thing to miss!
[+] KohgnaK|11 years ago|reply
o_O

Usually I have one weekend where I just crash and I am utterly useless but that's pretty impressive/concerning...

What field you're in?

[+] devbootcamp|11 years ago|reply
I love to code at 3am but I was always tired with a full day of work to do that. What worked for me was to change my sleeping schedule so that I was the most focused, alert, and hungry. I go to bed at 9pm and wake up at 3am. This gives my side projects the most focused, well rested me. The funny thing is, I'm so excited to get up and code I get up without an alarm clock.
[+] swah|11 years ago|reply
Do you have a family? Sleeping at that time would be difficult unless you live alone...
[+] kyled|11 years ago|reply
Some things I noticed about myself.

- Less is more. Getting burnt out leads to bad code and less productivity. Avoid the situation by giving realistic expectations. Ask for additional help if needed. It's important to know when to say no and provide alternative solutions. Saying yes all the time is actually unprofessional.

- You need sleep. That's when your brain is actually making connections to different ideas you thought about during the day.

- Over working can and most likely will lead to rsi (repetitive strain injury). Don't be stupid. Make sure you stretch and take brakes. I've been coding for 16 years and last two have been he'll because of it. Actually I'm considering changing careers or taking a while off. I love computing so this is a very hard choice.

- Are you guys doing incremental changes and deploying them ? Lean development? Quick iteration cycles lead to spending time developing the right thing and less wasted time on the wrong thing. Plus, people are much happier when they get what they want in pieces.

[+] KohgnaK|11 years ago|reply
I actually freaked out recently when my wrist went really sore to the point of almost getting blocked.

Since i got an ergonomic keyboard, slowed down my typing pace (whilst aiming to do less typos) and generally try not to use my mouse at all everything's fine again but it scared me a bit.

I'm trying to have small incremental changes but it is pretty difficult sometimes as I have to deal with user support / management tasks and sysadmin tasks on top of my dev duties. Small institutions, yaaaay!

[+] eswat|11 years ago|reply
I’m in my late twenties. What I found was to establish a routine around the times where I find I’m most productive.

So I’m not a night owl and can’t code into the evenings like you. I prefer to get up early and plow through stuff in the morning. What has helped was figure what I absolutely need to do in the morning to get myself in work mode, just do that, and leave the optional BS out the window. So that means on most days I’m working, I wake up, grab a snack, head to gym, show, then head to a coffeeshop and work my ass off (except now I guess; I’m on a quick break :P). Unless absolutely necessary (client fires) I don’t check email, IRC or SMS. I think what helps too is the routine includes something to improve my health, so I don’t feel guilty if I work for an extended period (in my case a heavy lifting session to offset whatever punishment I’m going to put myself through with bad posture afterwards). Maybe try to do something that will get you sweating before you’re getting ready for a coding marathon.

[+] brudgers|11 years ago|reply
The only work purpose for which pushing a team toward five straight weeks of mandated sleep deprevation is good is poor management. Good management matches scope, milestones and staffing to expectations.

This isn't to preclude the possibility of a person going manic on a project they own, but that's a case where those doing the work have control.

[+] swalsh|11 years ago|reply
I have a baby coming, so I've slowly been teaching my body to work during the day, and to sleep at night.

I haven't reached perfection, but I've made incremental progress. Here's what I have so far.

0. Don't work at night. For me, this is a practice in necessity, when my son is born I want to spend a lot of time with him. So i've been practicing on losing that time. The benefit is it's really made me focus on packing as much stuff into my "productive" hours as possible.

1. Stop drinking caffeine at night. Sleep is important.

2. Stop drinking alcohol on weekdays. Mornings are important.

3. Eat a balanced diet (i used to live off easy to obtain tasty food) Nothing is free, that means if you save time by eating fast food you'll pay somewhere else. usually your health. Being unhealthly leads to feeling lethargic. That's unproductive.

4. Before i get to work in the morning I have a realistic to do list of what I want to accomplish. On the drive home I re-evaluate how realistic it was. Since time is important, I want to maximize the return on investment for each minute. I make that decision in the morning, and I stick to it as much as is possible. Just like investing, you need to have a strategy, and you need to stick with it. Don't throw good money after bad though.

5. I keep a detailed log of what i'm doing as i'm doing it. This solves two problems, first it let's me pick up where I left off after distractions come, and two it provides a good way to remember things.

6. Nip things in the butt early. I used to say "this item is a low priority, i'll let it go, and do it later". But when it comes up later, even if it's not a big deal, it means someone is going to interrupt you. That makes it more expensive. The cost of that issue is now <time time to fix it> + <time to track that it exists> + <talking to someone about it> + <time lost on something more important when someone comes up to you to ask about a weird issue>

[+] KohgnaK|11 years ago|reply
Lots of great answers, thanks to all of you!

The solution of my problem probably lies in the mix of most of your answers; what I'm thinking about doing is:

1. Start waking up earlier in the morning and power nap to counterbalance any sleepiness in the afternoon

2. Be more strict in terms of diet, eat real food + no more coffee after lunchtime

3. Stop working overtime (weekend notably), to try to reduce the procastrination on small tasks

4. Talk with management and try to find some possible arrangements (maybe get a minion?)

5. Find a position where I would have only one major job, not 3 or 4.

Cheers!

[+] larrybolt|11 years ago|reply
I'm still in my 20's, but I do need at least 5-6h of sleep to perform well the next day. Powernaps like i0nutzb suggests work for me too, but I wonder, are you anywhere near productive on any day between 8am en 11am? If not, wouldn't your employer understand you arriving later, if that means you're able to work more productively the rest of the day?