Hyrum qonuni (ko'rinmas interfeyslar qonuni)
Qonunlar 0 06.08.2023 214

Hyrum's Law Online

API foydalanuvchilarining etarli soni bilan shartnomada nima va'da berishingiz muhim emas: tizimingizning barcha kuzatilishi mumkin bo'lgan xatti-harakatlari kimgadir bog'liq bo'ladi.

(Hyrum Wright)

Hyrum qonunida aytilishicha, agar sizda API iste'molchilari etarlicha ko'p bo'lsa, API ning barcha xatti-harakatlari (hatto jamoat shartnomasining bir qismi sifatida belgilanmaganlari ham) oxir-oqibat kimgadir bog'liq bo'ladi. Arzimas misol, API javob vaqti kabi funktsional bo'lmagan elementlar bo'lishi mumkin. Yana nozik misol, API xatosi turini aniqlash uchun xato xabariga regexni qo'llashga ishonadigan iste'molchilar bo'lishi mumkin. APIning ommaviy shartnomasida xabar mazmuni haqida hech narsa aytilmagan bo'lsa ham, foydalanuvchilar bog'langan xato kodidan foydalanishi kerakligini ko'rsatsa ham, ba'zi foydalanuvchilar xabardan foydalanishlari mumkin va xabarni o'zgartirish ushbu foydalanuvchilar uchun APIni buzadi.

Shuningdek qarang:

Hyrum's Law (The Law of Implicit Interfaces)
Qonunlar 0 06.08.2023 214

Hyrum's Law Online

With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviours of your system will be depended on by somebody.

(Hyrum Wright)

Hyrum's Law states that when you have a large enough number of consumers of an API, all behaviours of the API (even those not defined as part of a public contract) will eventually come to be depended on by someone. A trivial example may be non-functional elements such as the response time of an API. A more subtle example might be consumers who are relying on applying a regex to an error message to determine the type of error of an API. Even if the public contract of the API states nothing about the contents of the message, indicating users should use an associated error code, some users may use the message, and changing the message essentially breaks the API for those users.

See also: