Live data from Hacker News

Protobuffers Are Wrong (2018)

reasonablypolymorphic.com

161–170 of 321 posts

Re: Protobuffers Are Wrong (2018)

#161

i used protobuffers a lot at $previous_job and i agree with the entire article. i feel the author’s pain in my bones. protobuffers are so awful i can’t imagine google associating itself with such an amateur, ad hoc, ill-defined, user hostile, time wasting piece of shit. the fact that protobuffers wasn’t immediately relegated to the dustbin shows just how low the bar is for serialization formats.

What do you use?

Re: Protobuffers Are Wrong (2018)

#162
post #155

Earlier quoted context omitted.

Sure you can look at it[1], but you're not expected to look at Apple Photos database. The computer is. Write a correct JSON parser, compare with protobuf on various metrics, and then we can talk. [1]: although to be fair, I am older than kids whose first programming language was JavaScript, so I do not think of JSON object format with property names in quotes and integers that need to be wrapped as strings to be safe…

I'm also "older" but I don't think that means anything. > Sure you can look at it[1], but you're not expected to look at Apple Photos database. How else are you supposed to figure it out? If you're older then you know that you can't rely on the existence or correctness of documentation. Being able to look at JSON and understand it as a human on the wire is huge advantage. JSON being pretty simple in structure is as a…

> Being able to look at JSON and understand it as a human on the wire is huge advantage

I don’t think this is a given at all. Depends on the context. I think it’s often overvalued. A lot of times the performance matters more. If human readability was the only thing that mattered, I would still not count JSON as the winner. You will have to pipe it to jq, realistically. You’d do the same for any other serialization format too. Inside Google where proto is prevalent, that is just as easy if not more convenient.

The point is how hard or easy it is for an app’s end user to decipher its file database is not a design goal for the serialization library chosen by Apple Photos developers here. The constraints and requirements are all on different axis.

Re: Protobuffers Are Wrong (2018)

#163
post #15

I share the author's sentiment. I hate these things. True story: trying to reverse engineer macOS Photos.app sqlite database format to extract human-readable location data from an image. I eventually figured it out, but it was: A base64 encoded Binary Plist format with one field containing a ProtoBuffer which contained another protobuffer which contained a unicode string which contained improperly encoded data (for e…

The JSON version would have also had the wrong encoding - all formats are just a framing for data fed in from code written by a human. In mac's case, em dash will always be an issue because that's just what Mac decided on intentionally.

Re: Protobuffers Are Wrong (2018)

#164
post #6

It is a 7 year old article without specifying alternatives to an "already solved problem." So HN, what are the best alternatives available today and why?

CBOR is probably the best and most standards compliant thing out there that I’m aware of.

It’s the new default in a lot of IOT specs, it’s the backbone for deep space communication networks etc..

Maintains interoperability with JSON. Is very much battle tested in very challenging environments.

Re: Protobuffers Are Wrong (2018)

#165

Protobuf's original sin was failing to distinguish zero/false from undefined/unset/nil. Confusion around the semantics of a zero value are the root of most proto-related bugs I've come across. At the same time, that very characteristic of protobuf makes its on-wire form really efficient in a lot of cases. Nearly every other complaint is solved by wrapping things in messages (sorry, product types ). Don't get the enum…

Agreed the CDDL to codegen pipeline / tooling is the biggest thing holding back CBOR at the moment.

Some solutions do exist like here’s a C one[1] which maybe you could throw in some WASI / WASM compilation and get “somewhat” idiomatic bindings in a bunch of languages.

Here’s another for Rust [2] but I’m sure I’ve seen a bunch of others around. I think what’s missing is a unified protoc style binary with language specific plugins.

[1] https://github.com/NordicSemiconductor/zcbor

[2] https://github.com/dcSpark/cddl-codegen

Re: Protobuffers Are Wrong (2018)

#167

I went into this article expecting to agree with part of it. I came away agreeing with all of it. And I want to point out that Go also shares some of these catastrophic data decisions (automatic struct zero values that silently do the wrong thing by default).

We got bit by a default value in a DMS task where the target column didn't exist so the data wasn't replicated and the default value was "this work needs to be done."

This is not pb nor go. A sensible default of invalid state would have caught this. So would an error and crash. Either would have been better than corrupt data.

Re: Protobuffers Are Wrong (2018)

#168
post #124

Earlier quoted context omitted.

Flatbuffers satisfies those requirements and doesn’t have varint shenanigans.

What about Cap’n Proto https://capnproto.org/ ? (Don't know much about these things myself, but it's a name that usually comes up in these discussions.)

Cap'n'proto is not very nice to work with in C++, and I'd discourage anyone from using it from other programming languages, the implementations are just not there yet. We use both cnp and protobufs at work, and I vastly prefer protobufs, even for C++. I only wish they stayed the hell away from abseil, though.

Re: Protobuffers Are Wrong (2018)

#170

I agree with the author that protobuf is bad and I ran into many of the issues mentioned. It's pretty much mandatory to add version fields to do backwards compatibility properly. Recently, however, I had the displeasure of working with FlatBuffers. It's worse.

Out of interest why not make the version part of say the URL?
Post reply on HN