fbpx

Protocol Buffers compiler

Ones and zeros in a binary tunnel

Not only is this project incredibly useful, but there’s a lot to learn from how it was built. When you need to send information to another computer or another component, the format of that message is critical. How do you define it? What do you do when you need to add more information to the message later? And how do you deploy software capable of handling the message across many different computers and coordinate different versions? These are some really tough problems that Protocol Buffers solves easily.

I remember working on a project once that used Protocol Buffers. It was myself and another person working in a remote office. One day, I added some new capabilities to the software that I was working on and my team mate continued using an older definition. We didn’t even notice it because everything just continued to work.

Protocol Buffers are a specification created by Google and define a file called a pro to file that is used to define the message fields. In other words, the proto file specifies what the possible contents of a particular message can be. There is also a utility program that knows how to read the proto files and generates code that can then be used in your program. This is effectively a compiler.

This project took about three months to complete in my spare time. All the code is currently located at:

https://github.com/muddledmanaged/Protocol

The code is open source and available for you to use under the MIT license. And I will be using this code in the classes to show you exactly how it was built including all the mistakes that I made along the way.

Skills

Posted on

June 16, 2015