Yay! protocol buffers are now open source!

I woke up this morning with an odd thought in my head. It was 4am, and instead of thinking of the absurdly awesome dream I just had, the thought running through my mind was simply:
“How am I ever going to work without protocol buffers again?”

And an hour later, voila : http://google-opensource.blogspot.com/2008/07/protocol-buffers-googles-data.html

If you do a considerably large amount of C++ or python programming, you really should look at that. It takes the best of Javascript’s objects style data representation, and the power of C++ classes, and tons and tons of nice little utilities like printing debug strings, compressing and decompressing from ascii, etc.

Having worked with protocol buffers for a while, I can say that they’re extremely useful, particularly when you have many levels of protocol buffers, that can be used to structure data very nicely, and read them in a jQuery-esque fashion.

For example:
parsed message blogpost
{
optional string posttext = 1;
}
parsed message blog
{
repeated message post = 1;
}

You can simply say

blog x;
x.mutablepost(i)->setposttext("Hello world");
string data = x.post(i).posttext();

You can read a more in-depth introduction here

0 Responses to “Yay! protocol buffers are now open source!”


  1. No Comments

Leave a Reply