Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Abstraction inversion
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Computer programming anti-pattern}} {{multiple issues| {{example farm|date=October 2013}} {{Original research|date=May 2009}} }} 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 (computing)|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 their implementation with complex mechanical details. * Many users attempt to solve the same problem, increasing the risk of error. == Examples == Alleged examples from professional programming circles include: * In [[Ada programming language|Ada]], choice of the ''rendezvous'' construct as a synchronisation primitive forced programmers to implement simpler constructs such as [[semaphore (programming)|semaphores]] on the more complex basis.<ref name="pipeline_on_ada">[http://www.pipeline.com/~hbaker1/CritLisp.html#fn2 Critique of DIN Kernel Lisp Definition Version 1.2, footnote 2] {{Webarchive|url=https://web.archive.org/web/20180506220654/http://www.pipeline.com/~hbaker1/CritLisp.html#fn2 |date=2018-05-06 }} - says (without references) that the term derives from critiques of the Ada ''rendezvous'', appears to be one of the earliest uses.</ref> * [[Applesoft BASIC]] and [[Lua (programming language)|Lua]] (when configured for desktop computers) have a floating-point as the base numeric type.<ref>[http://lua-users.org/wiki/FloatingPoint lua-users c2: Floating Point] Accessed 2009-10-12.</ref><ref>[http://www.lua.org/pil/2.3.html Programming in Lua : 2.3 - Numbers] Accessed 2009-10-12.</ref> While Applesoft did implement [[integer]] arithmetic, it was implemented on top of [[floating point|floating-point arithmetic]], and neither had any [[bitwise operation|bitwise operators]] (Lua added support in Lua 5.2)<ref>[http://lua-users.org/wiki/BitwiseOperators lua-users c2: Bitwise Operators] Accessed 2013-01-15.</ref> Applesoft also had no support for [[Bit blit|blit]]ting 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 Applesoft to run slower. * Creating an object to represent a function is cumbersome in [[object-oriented]] languages such as [[Java (programming language)|Java]] and [[C++]] (especially prior to C++11 and Java 8), in which functions are not [[first-class object]]s. In C++ it is possible to make an object 'callable' by overloading the <code>()</code> operator, but it is still often necessary to implement a new class, such as the ''[http://www.sgi.com/tech/stl/functors.html 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 (software)|Subversion]] version control system pays for the abstraction inversion of implementing a write-only database on a read/write database with poor performance.<ref name="lord_on_svn">[https://archive.today/20130222124420/http://sourcefrog.net/weblog/software/vc/subversion/lord-on-svn.html sourcefrog : Tom Lord on Subversion<!-- Bot generated title -->]</ref> * Using [[stored procedure]]s 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. * Microsoft's [[WinUI 3]] systematically replaces the title bar of the windows it creates with a custom one that ignores the end-user's color settings, always appearing gray instead. Applying the end-user's chosen color to the title bar requires using further customization code on Windows 11, and completely replacing the custom title bar with another custom one on Windows 10.<ref>[https://learn.microsoft.com/en-us/windows/apps/develop/title-bar Title bar customization - Windows apps | Microsoft Learn]</ref> 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 == *[[Leaky abstraction]] == References == {{reflist}} ==External links== * [[c2:AbstractionInversion|Abstraction Inversion]] at Portland Pattern Repository - extensive discussion, much of it taking "abstraction inversion" in the sense of "concealed complexity" [[Category:Anti-patterns]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Multiple issues
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Webarchive
(
edit
)