Occasionally I have to spend some late nights working on projects. It is not a common occurrence, but sometimes projects just need an extra night or two to hit a deadline. Unfortunately I have found that after more than 10-12 hours of work, my brain shuts down and I become about 1/10th as efficient as during normal hours. I hope to work effectively for 16-20 hours (not consistently, occasionally) so I don't think my problem is sleep deprivation.

What techniques or practices should I do to remain more effective when working for long hours?

This question came from our site for professional programmers interested in conceptual questions about software development.

9

If you were working less hours, you would be more productive. Excerpt from Peopleware - "It has been our experience that the positive potential of working extra hours is far exaggerated, and that its negative impact is almost never considered. That negative impact can be substantial... and "Extended overtime is a productivity-reduction technique, anyway. The extra hours are almost always more than offset by the negative side effects. This is true even if you don't consider the disruption of the team."
–
MichaelTJun 9 '13 at 17:50

8

@JeffO: not true and slightly uncalled for: the need to work more hours to complete this particular project may have absolutely nothing to do with the OP's own productivity at work, but may be consequence of others' lack of productivity (possible, but not that relevant) or a clear sign of bad upper-level planning (very likely, very relevant).
–
haylemJun 9 '13 at 17:51

why did this get moved from programmers? i didnt have a productivity account and this question was specific to programming. i wanted a answer by programmers for programmers, not general purpose productivity.
–
Justin MeinersJun 9 '13 at 20:38

@JeffO that assumes im the only one making decisions, I have full control of the project, the project was scoped correctly, and It is not dependent on external factors. Silver bullet answers sound nice, but show that they are no backed by industry experience.
–
Justin MeinersJun 9 '13 at 20:42

4

Justin - I would assume it was moved because it was not wanted on programmers. The productivity community here has programmers as well as a wide range of other individuals and this question is really not about programming, so I would wait and see what answers you get.
–
Rory Alsop♦Jun 9 '13 at 21:31

10 Answers
10

Short Term Solutions

If there's no way to work around that crazy rush coming up, make sure to try to follow the following rules.

Take Breaks

Take occasional breaks (or even naps), and make sure to rest yourself both physically, mentally and nervously.

Have a laugh with coworkers and friends, call your significant other or kids to ask about their day and check in, grab some food, read a few pages of a book, etc...

Sometimes I even prefer to pass on a bit more sleep time to do something fun, as I find I get more satisfaction out of that rather than a strict "sleep-eat-work" cycle.

Eat Well

Be careful to eat proper food and monitor your nutrients' intake.

Energy levels are important, and some food have an impact on your mood and well-being. Coffee and energy drinks may give you a boost, but they're not a workable solution if it's for more than a day (and beware of coffee addiction).

Know When to Keep at It and When to Get out and Clear Your Mind

Don't switch tasks too often to not lose focus (those damn context-switches and distractions that make you lose concentration and creativity on a task you were deeply involved in...).

But do not work on exactly the same thing for too long either: banging your head on something for more than 2hours doesn't bring anything good. In fact, educational institutions are well aware that having students study the same thing for long periods gets less effective after more than 90 minutes. Past that point, it's best to introduce longer breaks, or different topics altogether (so, these 4-hour math classes you may have had in high-school could have been organized in more efficient sessions...). The same applies to professional work, or any task requiring hard and sustained focus.

Get Your Time Back and Recover

If you had to make time for work, make sure work makes time for you. You gave them those hours of your life, make sure to get them back or to get paid. And make sure to use them to recover.

You don't need to recover N hours of sleep by seeping N hours, but a good night's sleep will be necessary. Also, be aware that pulling allnighters affects your body in many non-obvious ways: your stomach will be upset, you'll sweat more than usual, you might get shaky, etc... All these things may show up even though you might not realize them and not feel that tired.

Stay SAFE!!

Not related to staying productive, and it's kind of the advice we give to cyclo-motorists, but... if you're tired:

avoid driving (for your and everyone else's safety...),

eventually, you'll need to sleep. There's no way around it.

Lack of sleep is very detrimental on your health and it's been linked to perception of life level and conditions, and to life expectancy. We all need to pay the sleep-bank in the end. Dearly.

Longer Term Solutions

Plan Efficiently

If you're in a situation to rush, it means somebody screwed up something somewhere sometime up front. Definitely do a retrospective or post-mortem to figure out why that was, so it hopefully won't attempt again.

Plan your time more efficiently. Figure out if that was a project planning issue, or a personal planning issue. Most of these tips were written with the assumption that you were already fully productive during your normal work-time. If you weren't, that probably needs fixing on your level.

Learn to Let Go

In the wise words of Douglas Adams:

"I love deadlines. I like the whooshing sound they make as they fly by."

Deadlines are sometimes not meant to be met. Learn to let go and mitigate.

The job will be here in the morning or on Monday, you can be sure of that. However, it's not guaranteed your co-workers will be here to help you during the week-end. Plus some will find that you make them look bad by working harder than needed, though you probably shouldn't. (But hey, if that's something you are passionate about, go for it. But do know that this isn't right and you need to find a better balance)

Also, there's no point in staying until midnight on a Friday evening to send out a report that people will only see on Monday morning anyways. Even today with smartphones and stuff. You can send it Monday morning, or show up earlier on Monday morning (when you'll probably be rested and way more efficient anyways).

Change Your Job!

If the problem doesn't go away, managers and coworkers refuse to look back at the project to figure out what was wrong, and that's likely to happen again and this isn't something you do for fun and entirely willingly: run for the freaking hills!

To your further reading, I would strongly suggest the books Slack and Peopleware (Third edition published June 1st 2013?!) .. and possibly Death March too. The first two I highly recommend.
–
MichaelTJun 9 '13 at 17:55

@MichaelT: There's a lot of good books and references for this. Too many to list them all, and some re-hash some of their content so I don't want to list too many anyways. Plus some get a bit out of fashion (though they can still be very good reads, like the One Minute Manager or the Mythical Man Month). These are indeed good reads. The 7 Habits of Highly Effective People, though very "self-help"-y for me, isn't bad either. Randy Pausch also gave an amazing lecture re-using principles form some of these.
–
haylemJun 9 '13 at 19:38

Observe yourself

One key to answering this question for yourself is to observe yourself each time you work long hours, and note what worked and what didn’t work. This is how I’ve found out what works for me.

Physiology

Food

Your brain consumes glucose, so if you don’t eat every 3 or 4 hours, you’ll get low on brain energy. So eat regularly: breakfast, lunch, dinner, 9pm, midnight, and 3am if you have to.

Secondly, your diet is hugely important: eat low-GI food. Do not believe any advertising that says bread, pasta etc. is low GI; in my experience, that’s rubbish. Meat and nuts are low-GI; carbohydrates are not low GI. Why avoid high-GI food? Because for the first 30 minutes you get very high on energy, but then you get very tired after that, making you very drowsy and unproductive.

Appropriate drugs (endorphin)

However, there’s a place for a high-carbohydrate meal, and that’s where you can get a dose of endorphin by taking a power nap – anything from 10 minutes to a full 45-minute sleep cycle. Even just lying on the floor for 10 minutes can give you a power boost. For me, 10 minutes on the floor gives me 2-plus hours of high alertness afterwards; it works much better than 2 hours of drowsiness I get by trying to fight my body’s rhythm by just working through the drowsiness. Observe what works for you and go with that.

To really tip the scales in favour of getting a power nap, eat a protein-heavy breakfast (e.g. meat, eggs), a carbohydrate-heavy lunch (pasta, bread, apple), and then after lunch you’ll be very drowsy; do not fight this; take a siesta, get that refreshing rush of endorphin, and when you get up, you’ll have essentially given yourself a second fresh morning-start alertness to your day, effectively giving you TWO productive mornings in one day.

THEN, for the rest of the day, snack on fruit so that you keep your energy up, and don’t sap it with any heavy food. Ask a doctor or dietitian for more accurate and detailed advice on this; I got this plan from a doctor, but I may have some details inaccurate.

Many people prefer to counter their body’s natural rhythm by taking caffeine, but my drug of choice is endorphin: I prefer a short siesta instead of an afternoon cuppa. However, living in the Western world, I find it very hard to do this when other people are around. Another reason I dislike caffeine is because it stays active in your body past the time you want it, i.e. it works to keep you awake when you finally want to go to sleep, so you wake up tired the next morning and need… more caffeine – it leads to a self-perpetuating cycle of sleep debt. That’s not how I want to live.

Air

Besides food, your brain needs oxygen, and lots of it. I suspect that the period for productive brain activity, in the short cycle, is about 15 or 30 minutes. So you will find you actually perform better if you do something counter-intuitive – step away from the keyboard for a few minutes every so often and get some exercise! I often take a walk around the block, which also gives my brain some air – very important, and if it’s daytime, I get some sunshine – very important in winter to help prevent me getting the winter blues.

Other things you can do:

Take a shower.

Play catch with a soft ball with a co-worker for 5
minutes.

Just do 10 or so push-ups - it’s really short, intense, gets
the blood and air pumping, but you don’t lose track of all those
programming items that you need to hold in your head.

Alpha mode

One of the benefits of physical activity is that your brain often switches into alpha-mode, where you can "see" whole problems and answers to solutions. This often happens in the shower, when just waking up, or when exercising. I have solved so many bugs at the gym during lunchtime.

Psychology

Then there’s the emotional side of being productive – being pumped, positive, and enjoying the work. What I’ve found works for me has become a list that I use like a recipe; here’s my technique:

Clear the decks - get annoying things in your head written down,
scheduled or done, and out of the way.

Prevent interruptions - get
comfortable - not hungry, not full; put up Do Not Disturb signs or
body language.

Tune out and focus.

Get your emotions pumped -
imagine the success. Getting pumped can include listening to good music, thinking hopeful thoughts, people contact planned/done, ...

Understand the task, the issues, materials/code.

Think through what you're going to do. Envision the goal and steps. Plan your approach; write down the steps/task list.

Do it - do the work.

Rest and refresh yourself, and enjoy the fruits of your labor.

Whole being

You can consider yourself to be like a car with several power sources– emotional, spiritual, mental and physical. Each one has its own “petrol” tank. For peak energy, all of them need to be loaded up and going well. You might be physically fit and well, but emotionally broken; this will really impact your work – you need to spend time on your relationships and have some alone time. You might be emotionally well but spiritually bankrupt – you need to reconnect with God the creator; you could even pray and ask for help. Or you might be physically low – you need to exercise and maintain your body.
Source: Reading Your Gauges by Bill Hybels So you need to read your gauges and fill up the tanks that are low.

Lastly

Avoid distractions and procrastination. E.g. don't spend too much time on StackExchange like I just did.

The situations you're in should just not happen. Cure the organization problem behind them. Working tired is best way to create a broken product, and in single hour of such overwork you can (and likely do) create weeks of problems. Maybe not directly traceable, as they are imposed on customers, support, QA and other departments or the teammates.

Stop hoping to work 16 hours, and close up the keyboard as soon as you feel your brain is not up to good work. That's good idea even in regular work hours, but around a deadline when the regular reviews, tests, other stuff might be put to back burner? If you were driving half asleep would you press on?

@haylem: Plenty of data, but not in one place. 40 hour work week was optimal for the assembly line. The book Drive by Dan Pink goes into detail about why the assembly line methods fails with the new knowledge economy system. Many state-of-the-art programming companies have flexible hours. The more extreme ones use ROWE, meaning come into the office whenever they want.
–
MuzJun 10 '13 at 7:51

3

@Muz: interesting... though I don't think ROWE sounds like a good idea and something beneficial to workers! Not because I think they should have the opportunity to slack off and get paid, but because this approach introduces 2 issues: a) gaming (with some employees who will try to get credit for work they had little to do with) b) no guarantee of salary if there's actually no work to do! All that could make the environment quite toxic for the workers.
–
haylemJun 10 '13 at 7:55

I noticed that taking a 15-20 minute break every 2 hours helps a lot. In that time, try to do something entertaining, and not related to work:

have a chat/laugh with your colleagues/friends

watch a 20 minute comedy show

play a casual game

grab something to eat

maybe take a nap

go outside for a walk

If you have to work for 10+ hours, don't do it on a day to day basis. Do it for a few days, but after that take a few days for yourself, with little to no programming.

I had 2 weeks of hell once (12-16 hours / day + weekends) - after that I couldn't work (productively) for about a month or so, so be very careful how you manage your time, it's very easy to get overworked, hard to recover.

Same goes for sleeping, with 3-4 hours of sleep per night, you will manage for a month or so, but after that you won't be able to wake up, and will sleep 10+ hours / day, with little to no productivity in any activities.

Note:

This depends a lot on your age, if you are ~25 or younger, you probably won't feel these effects as fast, but you will eventually.

This might be a bit bizarre and confrontational, but I have found that when I'm working over 75 hour weeks, taking on extra projects unrelated to work (yes, doing more) helps me increase my productivity.

I took on a few professional committee roles, started a band and went gigging, became a mod on SE, started coaching and mentoring others, talking at events and raising children and thus made my long hours at work seem much easier - I got more done, my annual review ratings improved and I won better roles.

I found my hard limit on long term productivity was above 85 hrs or so. I could manage maybe 4 weeks before my output crashed and I'd need a break.

I agree with that. Or at least, maybe it doesn't make me really more productive, but helps to slow-down the rate of the decrease in my productivity induced by sleep-deprivation. That's what I mention in my answer about needing to rest nervously and mentally (in the "Take Breaks" section). Getting your head out of your problems is better, and can sometimes be done faster than by getting some sleep (e.g. watching an episode of a comedy show, engaging in a quick deathmatch or pong game with a co-worker, or anything that works for you... like working on different project for fun!)
–
haylemJun 9 '13 at 23:32

1

However, following on what I just said... beware of procrastination. If you end up being more drawn to your fun side-project, you may end up wasting even more time (and maybe tiring yourself some more and becoming more prone to errors). That's a dangerous path if you don't exert control on yourself.
–
haylemJun 9 '13 at 23:34

1

I've faced situations where working long hours is more productive. But the catch is that it has to be consensual. Sometimes when you're known for pushing yourself to the limit, people will try and push you beyond your limit.
–
MuzJun 10 '13 at 7:57

Agree with a lot of what others have said. However, I'll add one thing: Programming and other heuristic tasks is about being in flow.

Flow is about having tasks that are just a little bit harder than what you think you can manage, but appears within reach with a little more effort. There are plenty of other resources on this, so I won't go into detail.

But quite often it can take a very long time to get into flow. You'll lose the flow when you go into sleep, or when you zone out at work. I find that my optimal work schedule is doing 3 days of 12-18 hours of programming, and taking whole breaks for 4 days a week. Unfortunately, there are very few workplaces that relinquish that much control; even the "flexible hours" workplaces don't.

My suggestion: Push yourself. If your brain shuts down, you need a lot more rest; a few 10 minute breaks won't cut it. What you want to do is reach some kind of 'martial trance' state of mind where you're fatigued, but the fatigue blocks out all other thoughts and makes you focus purely on the task at hand.

No doubt you'll still have to do some 'work' when you lack rest... use this time to write up pseudocode, or task lists. Use it to do mundane tasks like cropping icons or whatever preparation tasks, so that you can do the heavy duty coding later.

I actually mention that in my "Know When to Keep at It". Research disagrees with you on the duration of that "flow" period though. Or maybe your stated schedule is acceptable, but I assume the 18 hours aren't on banging at exactly the same problem (which would make sense I assume, it sounds reasonable to remain perfectly focused while coding away and making good progress on the way, without it stopping you because you get frustrated by a roadblock). I also wouldn't recommend pushing to hard. It works at first, and will work for a while. Until your burn out.
–
haylemJun 10 '13 at 10:05

Maybe you have student approach and leaving more to the end of project?
If everything is ok which you and problem lays on the PM side, you need to react and don't let yourself overworking.
This make no sense because as you've wrote your productivity id 1/10 of normal. this is of course true there are some tricks (15min napping) but this is working on a short terms and not to everyone (for me not :()

If you or your PM/BOSS cannot handle tasks in proper way,
I would highly suggest you to start using tools like SmartGTD more information can be found on the webpage http://smartgtd.com/

This is Time and Tasks manager available on iPad soon on iPhone and all other devices (Android) there is also WEB version on the way.

Consider using a pomodoro timer like http://tomato-timer.com/ that will force you to take a 5 minute break every 25 minutes.

The pomodoro technique is really good for working on the same task for long periods of time. I find it really helps me keep focused when I'm trying to write a blog post or doing bug testing. More info on the technique is here: http://pomodorotechnique.com/