Leaky abstraction
Encyclopedia
A leaky abstraction is any implemented abstraction, intended to reduce (or hide) complexity, where the underlying details are not completely hidden. The term is most frequently used to call attention to a flaw in a software or hardware abstraction.

History

The term "leaky abstraction" appears to have been coined in 2002 by Joel Spolsky
Joel Spolsky
Avram Joel Spolsky is a software engineer and writer. He is the author of Joel on Software, a blog on software development. He was a Program Manager on the Microsoft Excel team between 1991 and 1994. He later founded Fog Creek Software in 2000 and launched the Joel on Software blog...

. However, an earlier paper by Kiczales
Gregor Kiczales
Gregor Kiczales is a professor of computer science at the University of British Columbia in Canada. His best known work is on Aspect-oriented programming and the AspectJ extension for Java at Xerox PARC. He has also contributed to the design of the Common Lisp Object System, and is the author of...

clearly describes some of the issues with imperfect abstractions and presents a potential solution to the problem by allowing for the customization of the abstraction itself.

The Law of Leaky Abstractions

As coined by Spolsky, the Law of Leaky Abstractions states "All non-trivial abstractions, to some degree, are leaky." In making this statement, Spolsky highlights a particularly problematic cause of software defects: the reliance of the software developer on the infallibility of an abstraction.

In Spolsky's article, he calls attention to many examples of abstractions that work most of the time, but where a detail of the underlying complexity cannot be ignored, and thus drives complexity into the software that was supposed to be simplified by the abstraction itself.

Effect on software development

As the systems we use become more and more complex, the number of abstractions that software developers must rely upon increases. Each abstraction attempts to hide complexity, allowing a software developer to create code that can "handle" all the variations in complexity that modern computing requires.

However, if Spolsky's Law of Leaky Abstractions is true, then in order to create software that is reliable, software developers must learn many of the abstraction's underlying details anyway.

Examples

Spolsky cites numerous examples of leaky abstractions that create problems for software development. The following examples are provided in his paper:
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK