(deviq.com) Postel's Law | DevIQ

ROAM_REFS: https://deviq.com/laws/postels-law/

Postel's Law (also known as the Robustness Principle) states: "Be liberal in what you accept, and conservative in what you send."

This principle is named for Jon Postel, who wrote it in an early specification of the Transmission Control Protocol, TCP (of TCP/IP fame).

In programming, Postel's Law relates to covariance and contravariance. Functions and APIs may be contravariant with respect to their inputs, but covariant with respect to their outputs.

In all of these cases, the intent is to minimize system failures. By accepting a variety of formats of inputs, a function or system is better able to deal with a variety of collaborating systems calling it. Likewise, by being consistent with its outputs, the system is less likely to break disparate systems that call it because the output won't surprise the caller (see also the Principle of Least Astonishment).

Local Graph

org-roam 33d862e3-ec9a-4271-8c8d-a132d57e1cf7 (www.google.com) postel's law - Googl... c5778629-1f8d-4c80-b54d-ad7343bc7076 (deviq.com) Postel's Law | DevIQ 33d862e3-ec9a-4271-8c8d-a132d57e1cf7->c5778629-1f8d-4c80-b54d-ad7343bc7076 //en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science) https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science) c5778629-1f8d-4c80-b54d-ad7343bc7076->//en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science) //en.wikipedia.org/wiki/Principle_of_least_astonishment https://en.wikipedia.org/wiki/Principle_of_least_astonishment c5778629-1f8d-4c80-b54d-ad7343bc7076->//en.wikipedia.org/wiki/Principle_of_least_astonishment