nidomiro

Software developer stories
en de

How to work on your projects on multiple devices

In the beginning of my programming-life I’ve never thought of synchronization of my projects as an issue. Back at the time I only had a Computer standing in my room. Then I got a Laptop from the company I worked for back at the time. Still, synchronization was not an issue by now because I kept private and work separate. But the whole journey began when I started studying, and I bought myself a Laptop. In the beginning I used a USB-drive to copy my workspace on, after I finished on one device, and copied it to the other machine then. It was simply ugly… After a few weeks I had hundreds of different versions, because I worked a bit on the Laptop, forgot to copy it to my Pc but wanted to save the possible progress I made.

The second step was a tool I knew from work: Mercurial, a version control system. Now I could just commit my changes and merge them. For syncing I used my own webserver, where I hosted a Mercurial server. No different versions of the same code, I thought was the result. But I was so wrong. In order to be in sync I needed to make a commit and push it to my server. There lies the problem. Sometimes I forgot to commit, sometimes I was just lazy and sometimes the code was not compilable, and I knew the “golden” rule from work: “Commit only compilable code”. So there were still different versions of my code. The usage of a separate branch dedicated to my “in-development” code didn’t fix the problem either. It fixed the problem with the rule, but I still forgot to commit and push sometimes.

My current solution came with the “cloud era”. Since I’m concerned about privacy I don’t use the commercial clouds like Google Drive or Dropbox. First I hosted my own ownCloud (version 4 back then) server, after several issues with disappearing files I switched to Seafile. Seafile serves me as my cloud since then. I use it to synchronize nearly everything, but the biggest benefit is, that I can now automatically sync my workspace directory between my Computer, my Laptop and any device Seafile supports. As long as I’m connected to the Internet, my changes are automatically pushed to the server.

This is my current solution to the sync problem. But I’m thinking about switching fully or in part to syncthing. With syncthing the devices can sync directly over the fast local network. They would only use the webserver if no other device is connected to the same network. This method is especially good for people that have a bad Internet connection. Here I would think of a setup like this: A webserver, a server in the local network (like a Raspberry Pi) and the clients. If one client shares a huge amount of data, it would be synced to the local server very fast. Then you don’t need to keep your machine running until the upload finishes, the local server will do it for you.

Of course, it’s up to you what you want to use. And for many people the existing commercial cloud services maybe a better solution, but not for me.