3 ms·
I think we need to add a fallacy about serialization and protocol changes, but I'm not sure how to summarize it in a simple sentence. Specifically, "magic" ser
by gwbas1c 8y ago
I think we need to add a fallacy about serialization and protocol changes, but I'm not sure how to summarize it in a simple sentence.
Specifically, "magic" serializers often have problems interoperating with different languages; or with different versions of a protocol.
I've come across serious problems where:
- An application's deserializer can't handle a new value included in a new version of a protocol, and thus crashes.
- A server needs to forward part of a serialized object unmodified to another server. It strips out unrecognized values, thus requiring that we upgrade all three pieces of software instead of only two.
- A server's serializer is so rigid that we can't add xml tags / attributes without lots of involvement with the team that works on the server; even though there's no real reason for them to be involved in all the details
- EdSharkey 8y agoI share your frustrations. I am enamored with serialization libaries like Protocol Buffers that schematize data in its unmarshaled form and strip the symbols from the data in its marshaled form. By representing properties of the data with codes, one is free to add/rename properties (but not remove) from the schema over time. Different versions of the schema can successfully marshal and unmarshal the same data as long as codes (and semantics of what the codes represent) never change. It's a very forwards/backwards-compatible way of working with data as long with you can handle managing semantics over time. By contrast, schema languages like JSON Schema or XML Schema may be more expressive about target language constraints than something like Protocol Buffers, but they often suffer from the brittleness of the "messages I consider correct must be considered correct by you in precisely the same way"-problem when their messages move over the wire.