A question that continually pops up when someone learns that GTFS-Realtime is intended to be formatted as Protocol Buffers (or Protobuf) is, understandably, “why?”
The documentation does little to answer this question for laypeople.
“Protocol buffers are a language- and platform-neutral mechanism for serializing structured data (think XML, but smaller, faster, and simpler). The data structure is defined in a gtfs-realtime.proto file, which then is used to generate source code to easily read and write your structured data from and to a variety of data streams, using a variety of languages – e.g. Java, C++ or Python.”
What does that mean? Why not JSON (which is smaller, faster and simpler than XML)? I’ve heard a number of complaints that Protobuf is something along the lines of “entirely unnecessary.” But it’s not— it serves a purpose.
In short, Protobuf is designed to be:
* efficiently generated,
* efficiently transferred,
* efficiently processed (machine readable), and
* unambiguously understood by programs written in many languages.
Continue reading “Mommy, what’s a Protobuf?”