Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any experiences with Protocol Buffers?

I was just looking through some information about Google's protocol buffers data interchange format. Has anyone played around with the code or even created a project around it?

I'm currently using XML in a Python project for structured content created by hand in a text editor, and I was wondering what the general opinion was on Protocol Buffers as a user-facing input format. The speed and brevity benefits definitely seem to be there, but there are so many factors when it comes to actually generating and processing the data.

like image 360
saint_groceon Avatar asked Aug 05 '08 00:08

saint_groceon


People also ask

What are Protocol Buffers?

What are protocol buffers? Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler.

Are Protocol Buffers still used?

In particular, it was designed to be smaller and faster than XML. Protocol Buffers are widely used at Google for storing and interchanging all kinds of structured information.

What are Protocol Buffers and how do they work?

In this article, we’ll be taking a deeper look into the concept of protocol buffers. What Are Protocol Buffers? Protocol buffers are a method of serializing data that can be transmitted over wire or be stored in files. The other formats like JSON and XML are also used for serializing data.

What are protobufs?

The current version of Protobuf is called proto3. Like JSON and XML, the Protobufs are language and platform-neutral. The Protobuf is optimized to be faster than JSON and XML by removing many responsibilities usually done by data formats and making it focus only on the ability to serialize and deserialize data as fast as possible.

How to send arbitrary messages in Protobuf?

The Any construct provides an effective way send arbitrary messages in Protobuf. There is zero magic involved which leaves room for different implementation options, but also very little documentation to help evaluating the options. I hope this post helped in shedding some light into how one can go about using Any.

How to use Protobuf pack and unpack methods?

The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example "foo.bar.com/x/y.z" will yield type name "y.z". (from the Any message definition)


2 Answers

If you are looking for user facing interaction, stick with xml. It has more support, understanding, and general acceptance currently. If it's internal, I would say that protocol buffers are a great idea.

Maybe in a few years as more tools come out to support protocol buffers, then start looking towards that for a public facing api. Until then... JSON?

like image 136
Darren Kopp Avatar answered Sep 28 '22 07:09

Darren Kopp


Protocol buffers are intended to optimize communications between machines. They are really not intended for human interaction. Also, the format is binary, so it could not replace XML in that use case.

I would also recommend JSON as being the most compact text-based format.

like image 36
Mark Renouf Avatar answered Sep 28 '22 06:09

Mark Renouf