World Library  
Flag as Inappropriate
Email this Article

Abstraction inversion

Article Id: WHEBN0000467011
Reproduction Date:

Title: Abstraction inversion  
Author: World Heritage Encyclopedia
Language: English
Subject: Anti-patterns, Leaky abstraction, Interface (computing), Abstraction (computer science)
Collection: Anti-Patterns
Publisher: World Heritage Encyclopedia

Abstraction inversion

In computer programming, abstraction inversion is an anti-pattern arising when users of a construct need functions implemented within it but not exposed by its interface. The result is that the users re-implement the required functions in terms of the interface, which in its turn uses the internal implementation of the same functions. This may result in implementing lower-level features in terms of higher-level ones, thus the term 'abstraction inversion'.

Possible ill-effects are:

  • The user of such a re-implemented function may seriously underestimate its running-costs.
  • The user of the construct is forced to obscure his implementation with complex mechanical details.
  • Many users attempt to solve the same problem, increasing the risk of error.


  • Abstraction inversion in practice 1
  • Examples 2
  • See also 3
  • References 4
  • External links 5

Abstraction inversion in practice

Ways to avoid this anti-pattern include:

For designers of lower-level software:
  • If your system offers formally equivalent functions, choose carefully which to implement in terms of the other.
  • Do not force unnecessarily weak constructs on your users.
For implementers of higher-level software:
  • Choose your infrastructure carefully.


Alleged examples from professional programming circles include:

  • In Ada, choice of the rendezvous construct as a synchronisation primitive forced programmers to implement simpler constructs such as semaphores on the more complex basis.[1]
  • In Applesoft BASIC, integer arithmetic was implemented on top of floating-point arithmetic, and there were no bitwise operators and no support for blitting of raster graphics (even though the language supported vector graphics on the Apple II's raster hardware). This caused games and other programs written in BASIC to run slower.
  • Like Applesoft BASIC, Lua has a floating-point type as its sole numeric type[2] when configured for desktop computers,[3] and it had no bitwise operators prior to Lua 5.2.[4]
  • Some people hold the opinion that microkernel design is an abstraction inversion (see the links). It is interesting that microkernels are also alleged to commit the design error of oversimplifying the components so as to overcomplicate their relationships.[5][6]
  • Creating an object to represent a function is cumbersome in object-oriented languages such as Java and C++ (especially prior to C++11), in which functions are not first-class objects. In C++ it is possible to make an object 'callable' by overloading the () operator, but it is still often necessary to implement a new class, such as the Functors in the STL. (C++11's lambda function makes it much easier to create an object representing a function.)
  • Tom Lord has suggested that Subversion version control system pays for the abstraction inversion of implementing a write-only database on a read/write database with poor performance.[7]
  • Using stored procedures to manipulate data in a relational database, without granting programmers right to deploy such procedures, leads to reimplementing queries outside the database. For example, large datasets (in extreme cases - whole tables) are fetched and actual filtering takes place in application code. Alternatively, thousands of rows are updated (inserted or even fetched) one by one instead of running a multiple row query.

Examples that are common outside professional programming circles include:

  • Using spreadsheet lookup functions to replicate the functionality of a database
  • Using variant data types as loop counters in Microsoft Visual Basic where an integer type is also available.

See also


  1. ^ Critique of DIN Kernel Lisp Definition Version 1.2, footnote 2 - says (without references) that the term derives from critiques of the Ada rendezvous, appears to be one of the earliest uses.
  2. ^ Programming in Lua : 2.3 - Numbers Accessed 2009-10-12.
  3. ^ lua-users c2: Floating Point Accessed 2009-10-12.
  4. ^ lua-users c2: Bitwise Operators Accessed 2013-01-15.
  5. ^ Distribute those centralized microkernels in The Network Hardware Is the Operating System (Francisco J. Ballesteros and Luis L. Fernandez, 1997) suggests that ill-designed microkernels offer simple abstractions with heavyweight implementations, and that this may be called an "abstraction inversion".
  6. ^ The article 'Microkernel' at gives many of the arguments against microkernels and suggests that it is an abstraction inversion to implement a modular high-level design using a low-level module manager.
  7. ^ sourcefrog : Tom Lord on Subversion

External links

  • Abstraction Inversion at Portland Pattern Repository - extensive discussion, much of it taking "abstraction inversion" in the sense of "concealed complexity"
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.