How to pass data in neutral way in C++
I have often thought what would really be the easiest, efficient (in terms of coding, performance, storage) way of passing data across a network or even just among several software applications.
Different solutions have been available depending on different applications. The current trend of using XML as a universal way to pass around data has been widely accepted.
But to anyone who has had the opportunity to create XML based applications would tell you that crafting code to handle XML can sometimes be a challenge. One good thing about using XML has been the availability of utilities, libraries or software that makes life easier to handle XML data.
One look at the contents of a typical XML file will tell you that it’s not actually the most efficient way of passing data in terms of storage. For example, take a look at the XML snippet below:
<name>John Doe</name>
<city>New York</city>
The required <name> and <city> enclosing tags create redundant data that needs extra storage or memory.
With web 2.0 on its way, may be one of the reasons that an alternative data format called JSON (www.json.org) has become an alternative to using XML.
Recently, I’ve read about an article of how Google passes data across its network cloud and among its applications. Google calls it protocol buffers and has opened up the process.
What it basically does is pass around the data as basic classes with getter and setter methods. The process is quite elegant and simple. You can read more about Google’s Protocol Buffers. The site provides information on how to use it in C++ (also Java and Python).
It would be interesting to see if the process gets adopted or may be Google would start providing data to the external world in this manner.







