O'Reilly logo
  • Peter Malmgren thinks this is interesting:

It is common to call an API a “contract.” This is not correct, at least in the legal sense of the term, as an API is not a two-way agreement. The API user (generally, the higher-level software) has zero input into the API and its implementation. It may use the API as-is, or not use it at all: take it or leave it! The API acts only to ensure that if both pieces of software follow the API, they are source compatible; that is, that the user of the API will successfully compile against the implementation of the API.


Cover of Linux System Programming, 2nd Edition


I’ve always referred to APIs as contracts, but I suppose this understanding comes from changes. There should be some kind of “contract” that the API won’t make any major breaking changes in between versions, and if it does, give consumers time to react and adapt their code. I think Linus Torvalds said something to the effect of, “We do not break user space!”