In software development, a leaky abstraction is an abstraction that leaks details that it is supposed to abstract away.

As coined by Joel Spolsky, the Law of Leaky Abstractions states:

All non-trivial abstractions, to some degree, are leaky.

In other words, a leaky abstraction is one which is unsuccessful in hiding all the messy detail’s it’s meant to cover up.

Example(s)

One real-world example is a printed bus schedule. Usually this is a fine abstraction which answers “how long until the bus arrives?” but it can fall apart in the case of outliers (e.g. bus breakdowns, more traffic than normal, construction). In these cases, the printed schedule is “leaky” and readers need to take extra information into account (e.g. “There’s a concert at the stadium tonight. Busses driving past toward the end or beginning are likely to arrive late.”).

Bibliography