Wednesday, July 9, 2008

Google Protocol Buffers

Tej Kohli always discuss technology and enhancement which gives new roadmap and makes a substantial path for moving forward . Tej Kohli recently noticed Technology enhancement offered by Google , Suddenly find that Google now offer Protocol Buffer which having many advantages over XML and might be goggle replaced XML soon in each application , because of its simplicity and fast robustness.
Its might be possible that Google soon replaced XML use and replaced with its Protocol Buffer . Google had announced an open project for a data interchange format called Protocol Buffers. Its work well with different wide range of data format with faster speed and planned own XML application to shipped to Protocol Buffer. Since used XML as a lingua franca to send messages between its different servers, but it is very complicated , because os XML creates large files and makes application slow. Kenton Varda of Google's Software Engineering Team makes remarks over its use and told that “best alternative for exchanging data over network or storing it onto hard drive, its compactness which not in XML and easiness . Imakes developer feel free to use it.
Protocol Buffer allow to define simple data structures in a special definition language, then compile them to produce classes to represent those structures in the language of your choice.These classes come complete with heavily-optimized code to parse and serialize your message in an extremely compact format. Best of all, the classes are easy to use: each field has simple "get" and "set" methods, and once you're ready, serializing the whole thing to--or parsing it from--a byte array or an I/O stream just takes a single method call.
Matt Cutts, remarks that “ Protocol Buffers automatically generates Java, Python, or C++ code: “Basically it’s a compact way for encoding data into binary format . Programmer just right simple description of a protocol or structured data and Google code regenerate a class in C++ , Java or even Python to read, write, and parse the protocol. By the use of this protocol data can be stored in Hard Drive , sent to network and used in very tricky way . This software available with Apache Software License 2.0.
Google had also work over standardize XML compression which make application little bit faster but new invention make more faster than before.
Protocol Buffers
• are simpler
• are 3 to 10 times smaller
• are 20 to 100 times faster
• are less ambiguous
• generate data access classes that are easier to use programmatically
An example, also from the Developer Guide:
let's say you want to model a person with a name and an email. In XML, you need to do:

John Doe
jdoe@example.com

while the corresponding protocol buffer message definition (in protocol buffer text format) is:
person {
name = "John Doe"
email = "jdoe@example.com"
}
In binary format, this message would probably be 28 bytes long and take around 100-200 nanoseconds to parse. The XML version is at least 69 bytes (if you remove white space) and would take around 5,000-10,000 nanoseconds to parse.

Upon a little further reading, here's what Protocol Buffers offer:
- the message itself is a nicely compact definition of names and values
- the "proto" file defines what you expect to see in the message
- the proto is used to autogenerate parsing code in several languages (Java, C++, Python), with methods for get, set, et al.
- the autogenerated parser turns the message into a well-defined object or class
- after parsing, the data in the message is very easily accessed and manipulated
The Google developers don't assert that this is a "replacement" for XML. It's just a better data carrier in many situations. The things that XML claims to be good at are still accomplished best with XML:
- XML is better for describing a text-based document with markup, whereas PB doesn't easily interleave structure with text
- XML is human-readable, and human-editable, whereas PB is squished into binary
- XML is self-describing, whereas PB relies on a proto file to describe the content of a message
What further enhancement be expected from Google , imagine that seems like bullish. But every one have to appreciate Google to moving web technology into next generation. Google is now big giant in Search engine and now sharing near about 60percent of total.

No comments: