Long flights can be pretty boring, especially if like me, you have a rock-bottom boredom threshold. I routinely fly from London to San Francisco , an 11-hour daytime flight. 

What to do…what to do… Maybe I watch a movie, then what? Watch another four? No matter how much reading, snoozing, eating I can do, it’s a lot of time to fill. Eleven hours is quite a lot of time in any scenario; it can feel like an eternity if I am bored. So, I discovered that programming is the best way to make any journey fly by.

Here are three tips if you plan to take a crack at coding on your next long-haul flight:

1. DON’T RELY ON WIFI

First thing you need of course is an environment where you can build and run your code. These days many planes have WiFi, but it’s not reliable enough to allow you to get in to any kind of flow (amazing if it works at all, but it does have limits). This can be easier said than done of course, but it’s worth investing the time before you travel to get something that works on your laptop – a build and test environment for the part of your application you want to work on while flying.  If you really don’t have an option to build and test your main project locally, then it’s worth carving out some smaller piece or even a side project. Or just learn that language you’ve been meaning to look at but haven’t yet found the time. 

The best thing you can do, as with most things, is practice. I started my company Undo in my spare time as an evenings and weekends project, so I learned to grab every spare few minutes to write a few lines of code or progress that bug a bit. An 11 hour flight was therefore a dream opportunity. 

One open question is whether or not you should pay for the in-flight WiFi, even when it’s available. It can be very useful to get to the web to look something up. But it’s also great to have a long stretch of time with no emails or other online distractions. I tend to sign up for the shortest duration if I find I really do need to, say, go Stack Overflow, but otherwise, WiFi is off, and I’m in the zone.

2. AVOID T-REX TYPING

Once you’ve got a machine you can work on, the next most important thing is the seat. Like many of us I’m usually back in economy. If the person in front of me moves their chair backwards, it’s game over (leaving you folded up and attempting to type like a short-armed dinosaur). So I will happily pay the $50 or whatever to get an exit-row seat or one at the front of the cabin. If you’re getting 11 hours of productive work for that $50 it’s very reasonable to expense that back to your employer. Not all front row seats are the same. E.g. from London I often have a choice between British Airways and Virgin Atlantic. In Virgin, the little table in your arm-rest on the left usually rests its corner on the armrest between you and the seat on your right. This gives a much more stable working environment than BA, where they’ve saved a few ounces and the table rests in midair, and so is quite bouncy every time you press a key, which can be annoying. Either way, the $50 is worth it. 

There are some downsides to the front of the cabin – one is that you need to put all your belongings in the overhead locker. You’re not supposed to put your laptop in the little pocket in front of you with the safety cards in it, but I find in practice the cabin crew doesn’t care – much better to beg for forgiveness than ask permission on that. There is also the risk that there will be a baby right by you as this is where the bassinets go. However, I fly a lot, and while I’ve often had babies making a lot of noise on the ground, I find almost always as soon as you’re airborn and settled, they calm down and just sleep (lucky them!). In the rare event you get a screamer who cries all the way, being a few rows behind in economy won’t make much difference.

Sometimes it’s even possible to get in to Premium Economy for something like $150. It’s worth asking when you check in. The variance in price is huge — it can be anything up to $2,000 depending on how busy the flight is — it’s a simple supply vs demand thing and the supply is about as inelastic as it gets.

Beware of new laptops that drain too much power. On a recent flight, my ThinkPad X1 would trip the breaker after less than a second. There is an “at-seat power mode” that you can configure, but only from Windows. I run Linux. 

I ended up plugging in my UK plug via US->UK adapter — even though in theory I didn’t need it, as it was a universal socket — but this meant the laptop would draw enough power so that I could remain connected for my 11-hour flight. 

Most seats on most long-haul flights have at-seat power these days, but not all — it’s worth checking before you fly. e.g. BA has this handy guide. Figure out which aircraft you’re on and do a bit of Googling; if you have a choice of route/airline this might be a key consideration.

3. TURN OFF THE CRYING CHILD

Some people swear by noise-cancelling headphones, although I find after a while my ears get too hot. Once I’m in the flow of programming the background noise gets filtered out by my brain just as well as noise cancelling headphones can do.

That said, if you’re still prone to auditory distraction, a pair of custom moulded ear plugs can also be well worth the investment when used across tens or hundreds of flights.

A few other things to consider before takeoff:

  • Pick a project that you can complete well within the flight time so you land with a sense of accomplishment rather than stopping midway.
  • Pick something fun and creative to work on, it will help cut through the monotony of the flight.
  • Make sure you have a good battery or are close to a power outlet (bring an adapter for international travel)!

Once you get used to it, the plane is a surprisingly productive environment — no one is going to come up to you and quickly ask you a question and so ruin your concentration. A sense of accomplishment after a long flight is a rare emotion, and one worth seeking out. Your fellow passengers get off the plane tired, groggy, and half-aware that they have just wasted many hours eating bad food, drinking subpar wine, and re-watching old movies, but you leave having accomplished something.

You do need to get used to certain limitations. A reference book and a laptop together will not work within the confines of an airline seat. Unless you are lucky enough to be flying Emirates First Class, you’ll need to rely on documentation on your laptop. Also, no separate mouse. One of the reasons I prefer ThinkPads is that after you get used to it,  the little nipple mouse is better than a trackpad. But then who uses a mouse much when coding anyway? Personally, I find the biggest limitation is you can’t practically use pen and paper to assist you. While there are certainly limitations such as these, you must trade them off against long periods guaranteed distraction-free and with nothing else to do.

With the strategies above, I get loads done, and the journey flies by (so to speak). What are some of your favorite mid-air productivity hacks?