#engineering #design #api #software
idea
Top layers trying to create abstraction are limited by their underlying layers, and leak those limitations, thus breaking the abstraction.
Therefore an abstraction cannot really be seen as real black boxes because they will leak limitations and querks of what's behind.
All non-trivial abstractions, to some degree, are leaky[1].
Examples of this are
- TCP which cannot guarantee packet delivery because of IP
- abstract collections are leaking the performance of their concrete implementations (e.g. when enumerating)
- SQL is abstracting the implementation of storage but is limited in perf by engine, indexing, size of tables, etc, + ordering of results if unspecified will leak index or storage strategy.
- When using interfaces, uncaught exceptions from infrastructure can leak to the caller.
A corollary called "Hyrum's law"[2] is that with enough users, any observable behaviors (including incorrect ones) will be depended upon by someone.
links
Law of implicit interfaces is a specialization of this law, telling that provided a large enough number of users, leakages will get depended upon.
Conceptual integrity is important precisely because abstractions are leaky.
references
[1]: Joel Spolsky / The Law of Leaky Abstractionsref is the seminal post about this.
All non-trivial abstractions, to some degree, are leaky.
~ Joel Spolsky
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