I develop a suite of productivity tools, for Mac, iOS and Windows. They all communicate with a sync server via a RESTful interface (using Protocol Buffers), but as we add new platforms, we realize the pain it is to recreate different versions of the same code just to communicate with the client, so we have thought of using a modular design:

  • The backend client module would be the same for all clients, so that changes to the protocol can be easily ported to all clients
  • Clients we need to support: Windows, Mac, iOS, Android, Web, possibly Windows Mobile

The only way I can think of is via a JavaScript module that's shared across all clients and handles communications with the server, but perhaps that's even more work because of the integration required with the JavaScript interpreter. Maybe we might be better off writing a couple of backend modules instead of just one.

  • 3
    What is a backend client module? The client that you are talking about, are you referring to a mix of desktop, web and mobile applications? – BenR Feb 22 '12 at 7:59
  • 1
    Lots and lots of languages are identical in all platforms. How hard is it to pick a multi platform language? Can you explain what language you're using now for the client and why it's not already multi-platform? – S.Lott Feb 22 '12 at 11:04
  • C is the only TRULY portable language. – Raynos Feb 22 '12 at 15:18
  • BenR: I mean the part of each individual client that is common to all, and which deals with communicating with the server. – Pablo Diaz Feb 22 '12 at 15:18
  • S.Lott: I'm using C++ on Windows, Objective C on Mac/iOS, and I'll be using JS for the web client and Java for Android. – Pablo Diaz Feb 22 '12 at 15:19

If you mean, write the code once and have it run on "Windows, Mac, iOS, Android, Web, possibly Windows Mobile": I don't think that's practical. You'll need to maintain several different clients.

But there are things you can do to make this less error-prone. You need to start with a rigorous and precise definition of what the server's inputs and outputs can be, then make sure that every one of the libraries obeys that definition. There are tools that can automatically generate client and/or server code from a WADL or WSDL document; those might be useful. At the very least, you'll need a unit test framework that runs all the clients against the same input data, and makes sure that they generate the same output.


If you want it to run in a browser it would be pretty easy to do this. Backbone.js, ExtJS (and probably bunch of other JS Frameworks) will do it without much problem. All you will have to do is setup a few objects and point them at the correct URL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.