
Ask HN: Tricks to integrate late coding session in current workflow? - KohgnaK
Hi everyone,<p>We&#x27;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&#x27;m at best when I&#x27;m &quot;in the flow&quot; which often leads me to code till 3
am - 4am.<p>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&#x27;s).<p>1&#x2F; Do you have any tricks or tips to ease the recover and have a somehow normal day after a late coding session?<p>I know that this approach while somehow good for work purposes is disastrous for health on the long run so:<p>2&#x2F; What tricks&#x2F;tips do you use during your working day to minimize interruptions (so you could go at least 1&#x2F;2 way &quot;in the flow&quot;) ?<p>Cheers!
======
i0nutzb
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...](http://io9.com/the-secrets-of-highly-efficient-
napping-1680906145)

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
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/](http://pzizz.com/)

------
drig
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?

~~~
jnbiche
Is he a very productive developer? One of your best?

~~~
annnnd
Probably not - makes short and simple programs for problems that looked
difficult at first. [1] ;)

[1]
[http://www.csd.uwo.ca/staff/magi/personal/humour/Computer_Au...](http://www.csd.uwo.ca/staff/magi/personal/humour/Computer_Audience/The%20Parable%20of%20the%20Two%20Programmers.html)?

EDIT: joke aside, I am thankful to the grandparent for posting the question. I
have the same question, with the difference that I also know the other side.
So I am following the answers closely.

------
vkr
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](http://amzn.com/0307465357) [2]
[http://amzn.com/0142000280](http://amzn.com/0142000280) [3]
[http://amzn.com/0307463745](http://amzn.com/0307463745)

edit: added Rework

~~~
zamalek
> 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.

~~~
pc86
I've struggled for _years_ with getting up at a respectable time. I can't
overemphasize this. There are classes (yes, multiple) in college I failed
because I just simply could not get myself up and to class at 8am three days a
week. That was when I was 18-20.

I'm 28 now, almost 29. I go to the gym 5 days a week at 5:30am. I'm up at 4:45
whether I set an alarm or not. I'm sure part of it is circadian rhythms and
the fact that I'm going to bed at 9pm instead of 1am now. And as a result, my
most productive coding hours have shifted from 7-11pm to 9am-12pm (give or
take). So I keep my morning schedule open for the real work, and pack my
afternoons with meetings and administrative work.

------
yourad_io
> 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.

~~~
KohgnaK
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?

~~~
yourad_io
Architect/Dev/Sysadmin/.../Coffee Boy for a startup. By now they know not to
call the police after "just" 24H but 48 :) Haha.

------
devbootcamp
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
Do you have a family? Sleeping at that time would be difficult unless you live
alone...

------
kyled
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
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
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
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
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
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
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?

------
known
[http://en.wikipedia.org/wiki/Procrastination#Health](http://en.wikipedia.org/wiki/Procrastination#Health)

