Hy·rum's law
/ˈhaɪ.rəmz ˌlɔː/ (HY-rumz law) noun
- With enough users of an API, every observable behaviour of the system will be depended on by somebody, whatever the documentation promises. The API never promised sorted results, but after the database migration changed the order, three integrations broke. Hyrum's law.
Origin
After Hyrum Wright, a software engineer at Google, who stated it in the 2010s.
In practice
Hide what you don't want depended on: randomise iteration order, return opaque ids and keep error messages out of contracts.
Say to your AI
List every observable behaviour of this function that a caller could depend on, including ordering, timing and error text, before we change it.
In plain words
- users depend on undocumented behaviour
- we fixed a bug and broke a customer
- people rely on the order of results
- any change breaks someone