Hacker News new | ask | show | jobs
by rco8786 763 days ago
As if I couldn’t hate protobufs any more. They go and layer on yet more complexity.

These sorts of things need to be as simple as humanly possibly and get out of your way so you can actually do some programming. Instead protobufs are the opposite. Full of backwards compat issues, footguns, and needless complexity that make them an absolute horror to work with.

1 comments

Do you have a preferred message protocol?
JSON with a good schema if you're doing it across languages?
XML, JSON, and YAML belong to a totally diffent class of use than protobuf, flatbuffers, capnproto, etc

It's like comparing apples and screwdrivers.

They're comparable for a lot of use cases. In fact many protobuf-based APIs will also have a JSON mode.
Exactly because the consumers of those API's exhibit a strong preference for one or the other.

Library/module/API developers often seek to deliver maximimum adaptibility in their interfaces so that consumers of them can satisfy their own more specific/pressing requirements.

imo it's mainly because protos are unusable on the web without something like grpc-web (which requires a proxy) and in general web support in protobufs always seemed like an afterthought, just barely working (if at all) which is kind of ironic considering it came out of Google
I'm sure there's some great schema implementation that you can bolt onto JSON, but personally I have never seen anyone actually using one in the wild.

With protobuf the schema is essential, it is the foundation. I feel this is a huge advantage especially for communication protocols.

We've used it. It's useful to define the contract between teams.

So you have 2 teams do a meeting, we work out a contract we like, dump that into a jsonschema and you can enforce by unit tests that schema is respected on each side (producer/consumer)

JSON is the serialization format. What's the IDL?
I've seen OpenAPI/Swagger in the wild a few times. It's a good way to specify the API for an HTTP server, whether it's JSON or something else. Biggest downside is the confusing name change.