Search code examples
pythonobjective-cencapsulation

What technologies are good for sending encapsulated data, and later converting it, between Python and Objective-C?


I'm attempting to create a client/server web-app. The client software is written in Objective-C (Mac), and the server software is written in Python (Linux). I'd like to encapsulate object data on either side, and send it across the internet to the other side. This will include standard types such as strings, doubles, and data-structures (arrays, dictionaries), along with binary files.

My question is, how would you recommend me going about doing this? What technologies are good for sending encapsulated data, and later converting it, between two different programming languages? Specifically Objective-C and Python?

Python has pickle/cPickle which will allow you to take Python objects and encapsulate them into a file, but un-pickling them leaves you with Python objects and not Obj-C objects. I've also seen XML and JSON, though I'd still be stuck with the issue of converting objects, such as a Python Dictionary into an Obj-C NSDictionary, or vice-versa.

From what I've gathered, XML/JSON may be difficult to use with binary data, requiring converting it into text first before encapsulating it. I may be sending large amounts of binary data (50-100MB per request), so a text-conversion would significantly increase the size of the file, something I'd like to avoid.

Thanks for any help!


Solution

  • If you're talking about a traditional browser based web app, then I'd probably stick with JSON or XML serialization.

    For anything else I'd suggest drum roll please...

    Google Protocol Buffers

    Small, fast, and has a decent set of providers for different languages.