4 ms·
>> Be conservative in what you send, be liberal in what you accept. Oh no... be very strict in what you accept. Once out there, you can't make it more strict.
by jbverschoor 6y ago
>> Be conservative in what you send, be liberal in what you accept.
Oh no... be very strict in what you accept. Once out there, you can't make it more strict. APIs should be as strict and defined as possible. Unless the API is not an API, but user input, then, yes, be liberal in what you accept
- saurik 6y agoYeah: exactly. Postel has even gone on the record to note how he is being misinterpreted a lot and what he meant was more like "to maximize ecosystem rebustness, make sure to accept as much of the specification as possible including all the optional parts for the things you accept, but prefer to only require and use the common subset of required and generally well implemented functionality for the things you send".
- CodesInChaos 6y agoFrom what I remember his example was a reserved field which you must set to 0 when writing, and ignore while reading to enable extensibility. In a modern context this would correspond to ignoring unknown keys in json, or ignoring unknown fields in protobuf. Sadly many interpret this as accepting an ill defined superset of the specification, which then turns into a complex specification as implementations rely on those extensions being handled in a specific way.
- lloydatkinson 6y ago100% agreed. Always laughed (but also silently angry) when I hear people spout this meme. Be strict in what you accept and be strict in what you return. That's what a contract is.