Hacker News new | comments | show | ask | jobs | submit login
Ask HN: Do you write code on the train? What's your setup?
33 points by hguhghuff 4 days ago | hide | past | web | 71 comments | favorite
How to program on a train on a one hour each way journeys every day, comfortably?





I use morning train commute time to think of logic instead of actual coding. I usually have a set of tasks I want to work on during the day, and on the train, I'm usually scribbling down algorithmic ideas on a notebook, trying to come up with alternate solutions to different problems and the tradeoffs involved. That way once I'm at work, I can simply get my morning cup of Joe and then get straight to work! Productivity is high for me this way :)

Using a notebook helps me structure my tasks (there is a certain indescribable goodness to actually writing on paper) and avoid more screen time (I spend waaay too much time in front of a screen anyway)


Spending 70 minutes coding on BART every day, my setup:

Headphones: Bose Quiet Comfort 35

Laptop: Lenovo Thinkpad t460 (has 2 batteries, so can handle compute-intensive tasks)

Backpack: The North Face (pick the thicker one so you can use it as a laptop cushion)

Here is the setup in action!

https://twitter.com/klizhentas/status/735863023097643012


Your twitter post says you have a 500TB SSD, seems like heavy (and expensive) overkill for a commute computer. Or maybe just a typo.

Definitely a typo, but having 500TB SSD on the laptop would be awesome!

I don't write it there. I utilize 'ambient thought'.

What I rather do is look at difficult code before the commute. My brain will subconsciously work it out. However in this period, you can't think about other things - no looking at your phone or checking out people on the train.


I work as a theoretical physicist, and I second this. Not only for code but mathematics and other chain-of-logic kind of work. Also not limited to train, but to doing dishes or other routine activities where the mind can decouple. It does happen though that I get stuck brushing my teeth for 15 minutes lost in thought.

IMO it's no coincidence a lot of people get their ideas in the shower or on the toilet seat. I'll also bet that ideas on the toilet seat are rarer now thanks to mobile phones.

I'm going to get downvoted for this. But when I ride the train into work that time is used for extra sleep or video games.

I use my train commute each way to nap as well. I don't think it's a terrible thing. Unfortunately having a long commute means less time either at home after work to unwind or less time to sleep. So I just try to catch up a bit. Plus it helps recharge me mentally, so that's good.

Yeah I agree; when I'm on the subway it's a video game. When I'm on the GO train I chat with my dad. I'm going to miss that when he retires next year.

Why would you get downvoted? Every time I see someone who can actually rest or have fun during commute I feel a bit jealous, so good for you!

This makes me want to write a geofencing phone app that vibrates when you get within ~1 mile of your station.

CityMapper includes this feature (no affiliation beyond being a happy user).

I take the time to continue studying Chinese!

What is the reliable way to not miss your station when napping? I stay awake in commute because of this.

Use an alarm on your phone in vibrate mode. After a while you won't need it.

The other trick is to keep your naps under 20 minutes. After 20 minutes you fall into a deep sleep, making it harder to wake up and leaving you feeling groggy after you do wake up.


Guess it depends, when I used to travel to the office every few months I was lucky enough that the train would terminate at my destination. So I could sleep in safety.

I've certainly observed commuters set alarms on their watches/mobiles based on their expected arrival times. I find that a little rude, but nobody else every seems to comment..


Every single time. Setup:

1. Turn on mobile hotspot (ideally wired - it makes a difference when on SF BART)

2. Throw the earmuffs on (I wear https://www.amazon.com/3M-Earmuff-Protectors-Hearing-Protect...)

3. For extra levels of sound proof, wear earbuds undernearth above

4. Turn on laptop (lenovo x250 with 9-cell extended battery)

Having a seat is critical. I'm lucky that my commute usually involves one end of the line to the other. This makes it easy to get a seat. Also, don't completely zone out into your laptop. More than once I've had people warn me to keep my eyes open for some of the more interesting characters who ride the BART.


> the more interesting characters who ride the BART

"Interesting" in a positive or negative way?


Usually negative.

I commute Nottingham>London about 3 times a week. Coding/working on the train is the only way to stay sane!

I have a Macbook Pro 2017 13". It's the first Macbook I've ever owned. It barely weighs a thing (1.37KG). Feels durable. And feels quite ergonomic to use. I can run 2 VMs in virtual box at full pelt for 1.5 hours and use 50% of the battery. I think that's pretty good. Best notebook I've ever owned.

Otherwise, Boss Quiet Comfort 25s.

4G is very hit and miss. I swear the newer East Midlands Trains carriages are surrounded by a faraday cage. That being said, they offer 15 minutes free wifi... cough MAC address... cough which performs very well.


Off topic rant: why is commuting to work still a thing for software devs? Everyday when I spend two hours in traffic to go to work and sit at a desk to code, I think I could do this at home just as easily and I'm the lead developer at my company who constantly needs to interact with people.

If we had better teleconferencing equipment, I would go in less than I do now.


15" MBP (2013, must be about time for a new one). Tethering via my android.

Unfortunately because I'm in NZ, mobile data is super expensive, so I only get 2.25GB/month. Turns out that's adequate for 1 hour of train per day (30min each way), but I have to be a bit careful. I use https://www.tripmode.ch/ to limit my usage somewhat.

The keyboard on my MBP is absolutely awful, and if I use it for more than about 20 minutes I get sore fingers. The backspace key requires about a tonne of force to register a delete. So I use a Coolermaster MasterKeys Pro S. It's a bit awkward using it on the train, but I usually do anyway because my fingers kill me otherwise. It helps if I have a spare seat next to me.

Working on the train shaves an hour off my office day, so I get more time with my daughter. I can work from home a couple days a week, but I prefer to go in to the office when possible since I find I focus better at the office.


Presumably you live either up Kapiti Coast or Upper Hutt/Wairarapa? The latter has tables which make things much easier.

Actually I'm in Mangere Bridge (I take the Onehunga train, which is quite sparsely used)

I love coding on a train (long-distance, rather than short commute). The whole concept of being productive WHILE also being transported is somehow very energizing.

I use an MBP 15", typically using train-wifi or tethering to my phone (4G subscription with unlimited data (and no throttling) for $35/month (299 SEK)). However, I try to optimize to not depend too much on wifi, just in case.

Overall I've tried to optimize my workflow to just use my MBP 15" instead of being dependent on an external monitor, external keyboard, etc. Does really help when traveling and avoiding office to be productive.


Setup is very simple, just 13" MacAir which is my main computer as well (I do have it docked to big monitor and keyboard/mouse on other occasions), there is reliable and fast wifi on our trains so I dont need anything else then seat with a table.

Main thing is knowing what I have to work on that morning, so when I open computer I just jump on writing code and don't have to think about it.

I usually try to do simple things on my commute: maybe little refactoring or trying to replicate some edge case, I rarely do anything complex as my journey is just 30 minutes.


I use my notebook and put it on my lap, which allows me to write code quite comfortably. I listen to music in order not to be distracted by other passengers. Tethering via my phone, having a reliable connection and an unlimited data plan means I can do pretty much anything. If I'm on a train for a longer period of time, we also have power plugs to recharge.

However more recently, I have switched to reading books. My nearly two-hour commute every day is the time where I can read w/o anything else going on.


I use my notebook and put it on my lap, which allows me to write code quite comfortably

That seems ambiguous.

https://en.wikipedia.org/wiki/Notebook_(disambiguation)

In any case "notebook" is probably a little too generic for the asker, care to share which notebook in particular and what makes it well suited for computing while commuting?


I have an Asus Zen Book Flip, which is super light. Also, I use xmonad and a vim-style editor, which allows me to work w/o relying on a mouse.

Reading through the rest of the responses, I'm baffled by how incapacitated people seem to be when their internet connection goes out. Sure, if you're going to configure a cloud server, internet access is required, but people have turned many things that once were done locally over to the cloud, without ever considering if that's actually a good idea (specifically talking about availability now, although there are other problematic angles as well).

15" Macbook Pro (2015). More than enough battery life for an hour commute and a meeting once I get to work. if I need to conserve battery life, turning down the screen brightness makes a big difference.

I try to have everything I need already downloaded to the laptop, but when I need internet, I tether to my phone.

I carry everything in an REI Novara commuter pannier, which a great commuter bag for a bike -- two simple clips hold it securely on the bike rear rack so it's easy to unclip from the bike when I park at the station (and to clip back on for my commute home), and it has a built-in shoulder strap and a rain cover in its own pocket. Sadly, it's been discontinued, not sure what I'll replace it with when it finally wears out.

https://www.rei.com/product/780448/novara-commuter-single-pa...


Ortlieb are the EU go-to for these kinds of bags: https://www.ortlieb.com/en/hinterradtaschen/

You can find cheaper but these bags are very durable. They’ll last many years.


> turning down the screen brightness makes a big difference.

absolutely. On a long plane ride from the US to China it makes a huge difference


I've been doing this for nearly five years now, so I've gradually built up a system that works for me. Usually I'll use one of two devices:

* Asus Chromebook Flip (C100PA)

* iPad Pro 10.5 with keyboard cover

When I'm developing, I use ssh or mosh to access my workstation in the office and then tmux+vim. Mosh works pretty great with poor connectivity. I've pretty much mentally mapped the signal quality along my route, so I know when to look out the window for a couple of minutes to wait for signal to come back...

When I'm not developing, I'm usually using Gmail+Google Docs/Sheets/etc to get stuff done. They all work relatively well offline/online.

For connectivity, I use a Raspberry Pi Zero with a 4G data stick as a WiFi hotspot (the on-train WiFi is terrible, and tethering to my phone kills the phone battery way too quickly). That setup can run for 6-8 hours on a little Anker USB battery pack.


You are an hero for using Raspberry PI Zero with 4G data stick. Applauses. How do you power it? Battery or plug?

Why not use a usb battery pack for your phone? Seems like one fewer thing to carry, and no extra 4G cellular contract.

This generally seems to be my conclusion when thinking about making something cool with a Pi or similar, wondering if I’m missing something?


It's a fascinating idea. The Pi Zero is tiny (likely much smaller than the battery pack). I'd think it's not that big a deal. Plus, depending on your employer, they may have unreasonable requirements for subsidizing a phone contract vs a 4G stick.

I'd love to be able to do this, however ever since I was young I've found that I get motion sickness when I focus on a book/screen while travelling.

I don't generally get this effect when just being a passenger. I can travel for literally days in a car (or hours on a train) without feeling ill, but the second I look down to focus on some text, my stomach turns. User interfaces in the vehicle (such as the head-unit's screen, or the dashboard displays) don't do this to me, nor do things like posters on the train wall. It's only when I look down and focus on something close to me.

Does anyone else find this? What do you do about it (other than, you know, just not looking at small print when travelling)?


This is very common condition. I am no doctor, but it should be connected with your ears and there are exercises to help you build the muscles you need to fix it.

I am sure you can google some more information on it, this is just what I remember from talk of some ORL doctor friend of mine and that was few years ago.


Interesting, I'll have a look in to that. Thanks!

I'd like to propose an alternative: doing nothing. That works best when you are at window-side and watching the views. When I had 2 hours of roundtrip commute back in 2000, the travel itself was extremely soothing and mind healing. I think it worked pretty much like meditation. I used to think about the work, code, new ideas and they faded into other thoughts, then drift away. I didn't have a cell phone to distract me either.

We normally don't give our brains some idle thinking time. I think it's helpful in organizing thoughts, achieving peace of mind, reducing anxiety, improving creativity. Long commutes are perfect for that.


All true and in general I agree, but if working two hours on the train means I get to go home 2 hours earlier then I'd rather work on the train all things considered.

I appreciate this point of view. I have a counter argument though: why not work while in transit and use the gained time to relax at a place of your choosing?

Because commute is mandatory, there is no escape from it. But I have been postponing my plans to "meditate" at my ideal place for years now.

That's also kind of why people go to meditation centers and retreats and stuff—to voluntarily get a "mandatory" meditation schedule, so they'll actually do it.

I also really appreciate these brief periods of forced meditation!


Mobile hotspot. Once I accidentally executed a yarn install, would not recommend.

Mobile internet has gotten a lot better. I use an unlimited data plan as my home/anywhere connection (wifi tether). Yarn installs, video chats, the whole nine yards work fine. I try to keep it under 75GB/month to stay under the radar. It is very reliable and I love not worrying about brownouts or any of that. It can easily get 1MB/s down which is good enough for me.

For this exact reason I think that yarn's offline mirror is one of its best features: https://yarnpkg.com/blog/2016/11/24/offline-mirror/

I have about an hour train ride and in the morning I pull out my 17.1" Dell Precision M6800, my wireless mouse and hotspot and then just go to town for about the full hour. I'm first stop on the line so I get my choice of seats so I make sure to take the undesirable two seater on the upstairs of the train car so that way I can have the full seat to myself in order to use my mouse.

With laptop (12,5"), I think it's comfortable for one hour. If I have a specific problem, then : paper and pen! And write the corresponding program at my home.

Just on some private projects, not work. Nothing fancy about it, I use an old Lenovo X220t + USB Tethering + Some earplugs and a spotify playlist.

It's my most productive coding time!

XPS 13 9360 which has great battery time and a form factor of 11" but a monitor of 13". I also have an unlimited cellular internet plan that I use for ssh and rdp. It helps that I know vim well enough that I can code adequately on a remote machine if needed.

I just ordered this week a mobile charging station so I should even have more juice.


I'm not on the train anymore. But I coded and also wrote on the train.

My setup was t430 9Cell + ultrabay battery. Tethered to phone

I had really shoddy reception almost the entire train ride. So I was ssh'd into my home server. As I wrote code, it would sync every other minute if a file had changed. Compile, and run output through a screen session.


Core i7 15" Lenovo T520, oversized battery, dual SSD using the Ultrabay, dual boot from the BIOS. Use Windows on the main disk, Linux off of the other, and spend most of my time in the latter. The train WiFi is pretty good, and only patchy some of the way in. Reckon I'm hacking for almost 2 hours a day that way.

Can I ask you what is your country? We don't have WiFi in French train...

From his other comments, perhaps the UK. In that case, the Wifi will vary greatly depending on the route — none on some lines, good wifi on others.

There's wifi on some Danish and Swedish trains, but now with free roaming I find it less reliable than my phone's data connection.


As the earlier reply speculated, I'm in the UK. I should add that sometimes I use my phone's mobile WiFi hotspot, which is equally good until we hit the standard middle-of-nowhere blackspot.

I work in physics. Our experiment framework build is huge (O(100G)) and takes forever to build. Nightlies are distributed via network and can be build against.

Unfortunately this means developing on the go becomes nearly impossible without a solid network connection to CERN.


Dell laptop w/mobile broadband sim. Docking station at work.

Old Bose QC headset or just the headset that came with my phone.

3M screen filter (I'm not the only programmer on that train.)

I can get up to around >1 hour productive work depending on the task at hand.


+1 for screen filter

14" notebook with mate display, works great. Local dev web server. Good IDE with good language support. Keep as much as possible offline.

A problem is the unreliable 3G/4G connection and the onboard WiFi isn't that reliable as well.


http://devdocs.io has a offline mode using modern browser features.

If you have a Mac, there is the very good soft "Dash" to work offline: https://kapeli.com/dash

I try not to sit on my 45 minutes commute. Invariably a pregnant lady, elderly person or someone else who needs a seat more than me will come along...

Edit: this is in London, so the tube gets pretty packed during the rush hour


Be careful, I ended up with RSI from coding on the train daily. If you’re travelling 1st class you might be able to get your posture right but standard class seats are often far too cramped for working:

Professor of mine advocated pencil and paper. I don’t have the fortitude to do that daily.

However, rolling in and typing something up is amazing.

I can’t advocate doing that every day, but try once a week or once a month. It’s kind of awesome.


In train's restaurant, a cup of coffee, laptop open. SBB rules ;-) https://sbb.ch

Not exactly code but planning the control flow and reading the library documentation which I am using. Easily done on a small notebook and mobile.

Thinkpad laptop running Windows 10, using a mix of Visual Studio, Android Studio or Eclipse, depending on the project.

working on the train is never comfortable, but I find Dash comes in handy for offline access to documentation



Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: