Software developer blog

Remote editing

To achieve maximal productivity it is very important to choose the right tools for editing your code, and find the configuration that works best for you. When coding on a remote server one has several choices, but each has it's drawbacks. Let's sum up the possibilities.

Copying files back and forth: Usually that is how people do it at first. Obviously it's not hard to see the mayor drawbacks here. As long as you can test your code locally - which is not always possible - it is a good solution, although it can be really annoying when you forget to upload the latest version and need to continue your work somewhere else. Another drawback is that you are storing sensitive information on a potentiality unsafe computer. (Your laptop may be stolen, or you are simply coding from a machine that is not yours...) Also every time you are switching to another pc you have to install every single software you need for editing, and testing. The largest drawback however comes apparent, when you can not test locally (for example your local computer runs a different OS as the one you would need), and have to upload after each change to test. But this method also has an advantage over each of the remaining solutions: in situations where you can test locally, but have a slow ping (for example when you are using mobile Internet connection) or your connection is not continuous, this solution becomes much more productive.

Mounting the remote drive: If your server machine is Linux based (mostly that is the case) it's pretty straight forward to mount your remote file system. Most of the time I've been using sshfs or ExpanDrive to achieve that. This solution however  basically automates the previous solution, and inherits many of it's drawbacks. Your files are still stored locally (as temporary files), and saving a file is still a painfully slow operation. You also need the editor of your choice on every computer you are using. Both with sshfs and ExpandDrive temporary loss of connection can cause troubles. For example ExpanDrive first deletes the remote file before overwriting it. If your connection is lost during upload you'll end up without a saved copy on the server. If you closed the editor after saving, but before realizing that the save failed, than your local version is also gone. If your connection was lost prior saving, and you save the file, you may end up with a frozen editor until your connection returns. Auto saving files need to be disabled in your editor as every save will unexpectedly parallelize your editor for several seconds.

Using a remote desktop, or X server connection: This solution works pretty well for windows based servers and Linux servers running X. Probably the best choice for GUI and mouse addicts. The mayor drawback here, is that you'll probably need an administrator or root level access to the server, which may not be granted. With Linux servers you have to start an XServer on the remote machine, which waists resources, and may compromise your servers stability. When connecting to a Linux based server from a Windows machine like this you will need Xming or Cygwin as an XServer emulator, which again needs to be installed on each and every computer you are using. Cygwin is also huge, taking up lot of space on your hard drive.

Using simple SSH connection and terminal based software: This only works with Linux servers, but this is the most convenient for me. You only need an SSH connection, which is default on Linux and easy to install on Windows. It has a very low bandwidth profile compared to previous solutions. Once one gets used to programs like Vim and GNU Screen it also becomes way more productive than using GUI based software, since typing shortcuts is way faster than clicking with mouse. Note however that you will not always have a SSH account, in which case you need to fall back to either the first or second solution.

@ //