|
|
|
|
|
by cbsmith
3612 days ago
|
|
> Yeah. Don't do that without versioning your protocol. It's even less difficult to handle than maintaining API/ABI compatibility in a library. Actually, the whole point of that was so you don't have to version your protocol. Protocol versioning actually tends to make code maintenance a pain in the posterior, and working through old data really annoying. Instead, you do optional fields. If you don't want that, go ahead and just write raw bytes and don't bother with the serialization layer. > Having a message type defined as "Message_V1" OR "Message_V2" is still simpler than having "any or none of the fields from any iteration of the message definition, where consistency is solely defined in terms of the field/message validation code you write in every protocol consumer". But you don't have to do either. It seems like you aren't familiar with the use of protocol buffers. You just define optional fields with a reasonable default, and magically all the old protobufs get that default value. |
|
Or just keep using protobuf2, 'cause it's been working great for us for ~6 years.
> But you don't have to do either. It seems like you aren't familiar with the use of protocol buffers.
I've written my own protobuf compiler. I'm familiar.
> You just define optional fields with a reasonable default, and magically all the old protobufs get that default value.
That only works up until there's no "reasonable default".