Content deleted Content added
Programinfo (talk | contribs) Tags: Reverted Visual edit |
Stevebroshar (talk | contribs) →See also: Remove red link |
||
(94 intermediate revisions by 67 users not shown) | |||
Line 1:
{{short description |
{{Use dmy dates|date=December 2019}}
{{Quote box|quote=The essence of abstraction is preserving information that is relevant in a given context, and forgetting information that is irrelevant in that context.|source=– [[John Guttag|John V. Guttag]]<ref>{{Cite book | edition = Spring 2013 | publisher = The MIT Press | isbn = 9780262519632 | last = Guttag | first = John V. | title = Introduction to Computation and Programming Using Python | ___location = Cambridge, Massachusetts | date = 18 January 2013}}</ref>|width=25%}}▼
In [[software]], an '''abstraction''' provides access while hiding details that otherwise might make access more challenging.<ref name=":1">{{Cite journal |last1=Colburn |first1=Timothy |last2=Shute |first2=Gary |date=5 June 2007 |title=Abstraction in Computer Science |journal=Minds and Machines |language=en |volume=17 |issue=2 |pages=169–184 |doi=10.1007/s11023-007-9061-7 |issn=0924-6495 |s2cid=5927969}}</ref> It focuses attention on details of greater importance.<ref name=":0">{{Cite journal |last1=Kramer |first1=Jeff |date=1 April 2007 |title=Is abstraction the key to computing? |journal=Communications of the ACM |volume=50 |issue=4 |pages=36–42 |doi=10.1145/1232743.1232745 |issn=0001-0782 |s2cid=12481509}}</ref><ref>{{Cite journal |last1=Ben-Ari |first1=Mordechai |date=1 March 1998 |title=Constructivism in computer science education |journal=ACM SIGCSE Bulletin |volume=30 |issue=1 |pages=257, 257–261 |doi=10.1145/274790.274308 |issn=0097-8418 |doi-access=free}}</ref> Examples include the [[abstract data type]] which separates use from the representation of [[data (computer science)|data]]<ref>{{Cite book |last1=Liskov |first1=Barbara |chapter=Keynote address - data abstraction and hierarchy |s2cid=14219043 |date=1 May 1988 |title=Addendum to the proceedings on Object-oriented programming systems, languages and applications (Addendum) - OOPSLA '87 |journal=ACM SIGPLAN Notices |publisher=ACM |volume=23 |pages=17–34 |doi=10.1145/62138.62141 |isbn=0897912667}}</ref> and [[Function (computer programming)|functions]] that form a call tree that is more general at the base and more specific towards the leaves.
==Rationale==▼
▲{{Quote box|quote=The essence of abstraction is preserving information that is relevant in a given context, and forgetting information that is irrelevant in that context.|source=– [[John Guttag|John V. Guttag]]<ref>{{Cite book |
Computing mostly operates independently of the concrete world. The hardware implements a [[model of computation]] that is interchangeable with others.<ref>{{
Within a programming language, some features let the programmer create new abstractions. These include [[subroutine]]s, [[
Some abstractions try to limit the range of concepts a programmer needs to be aware of, by completely hiding the abstractions
▲==Rationale==
▲Computing mostly operates independently of the concrete world. The hardware implements a [[model of computation]] that is interchangeable with others.{{Citation needed|date=June 2018}} The software is structured in [[software architecture|architecture]]s to enable humans to create the enormous systems by concentrating on a few issues at a time. These architectures are made of specific choices of abstractions. [[Greenspun's Tenth Rule]] is an [[aphorism]] on how such an architecture is both inevitable and complex.
▲A central form of abstraction in computing is language abstraction: new artificial languages are developed to express specific aspects of a system. ''[[Modeling languages]]'' help in planning. ''[[Computer language]]s'' can be processed with a computer. An example of this abstraction process is the generational development of [[programming language]]s from the [[First-generation programming language|machine language]] to the [[Second-generation programming language|assembly language]] and the [[Third-generation programming language|high-level language]]. Each stage can be used as a stepping stone for the next stage. The language abstraction continues for example in [[scripting language]]s and [[___domain-specific programming language]]s.
▲Within a programming language, some features let the programmer create new abstractions. These include [[subroutine]]s, [[module (programming)|modules]], [[polymorphism (computer science)|polymorphism]], and [[software component]]s. Some other abstractions such as [[software design pattern]]s and [[software architecture#Architecture examples|architectural styles]] remain invisible to a [[translator (computing)|translator]] and operate only in the design of a system.
▲Some abstractions try to limit the range of concepts a programmer needs to be aware of, by completely hiding the abstractions that they in turn are built on. The software engineer and writer [[Joel Spolsky]] has criticised these efforts by claiming that all abstractions are ''[[leaky abstraction|leaky]]'' – that they can never completely hide the details below;<ref>{{cite web|url=http://www.joelonsoftware.com/articles/LeakyAbstractions.html|title=The Law of Leaky Abstractions|last1=Spolsky|first=Joel}}</ref> however, this does not negate the usefulness of abstraction.
Some abstractions are designed to inter-operate with other abstractions – for example, a programming language may contain a [[foreign function interface]] for making calls to the lower-level language.
▲==Language features==
===Programming languages===
{{
Different programming languages provide different types of abstraction, depending on the intended applications for the language. For example:
* In [[object-oriented programming
* [[Functional programming
* Modern members of the [[List of Lisp-family programming languages|Lisp programming language family]] such as [[Clojure]], [[Scheme (programming language)|Scheme]] and [[Common Lisp]] support [[Macro (computer science)#Syntactic macros|macro systems]] to allow syntactic abstraction. Other programming languages such as [[Scala (programming language)|Scala]] also have macros, or very similar [[metaprogramming]] features (for example, [[
===Specification methods===
{{
Analysts have developed various methods to formally specify software systems.
* Abstract-model based method (VDM, Z);
Line 57 ⟶ 40:
===Specification languages===
{{
Specification languages generally rely on abstractions of one kind or another, since specifications are typically defined earlier in a project, (and at a more abstract level) than an eventual implementation. The [[Unified Modeling Language
==Control abstraction==
{{
Programming languages offer control abstraction as one of the main purposes of their use. Computer machines understand operations at the very low level such as moving some bits from one ___location of the memory to another ___location and producing the sum of two sequences of bits. Programming languages allow this to be done in the higher level. For example, consider this statement written in a [[Pascal (programming language)|Pascal]]-like fashion:
Line 76 ⟶ 59:
===Structured programming===
{{
Structured programming involves the splitting of complex program tasks into smaller pieces with clear flow-control and interfaces between components, with a reduction of the complexity potential for side-effects.
In a simple program, this may aim to ensure that loops have single or obvious exit points and (where possible) to have single exit points from functions and procedures.
Line 92 ⟶ 75:
==Data abstraction==
{{
Data abstraction enforces a clear separation between the ''abstract'' properties of a [[data type]] and the ''concrete'' details of its implementation. The abstract properties are those that are visible to client code that makes use of the data type—the ''interface'' to the data type—while the concrete implementation is kept entirely private, and indeed can change, for example to incorporate efficiency improvements over time. The idea is that such changes are not supposed to have any impact on client code, since they involve no difference in the abstract behaviour.
Line 101 ⟶ 84:
== Manual data abstraction ==
While much of data abstraction occurs through computer science and automation, there are times when this process is done manually and without programming intervention. One way this can be understood is through data abstraction within the process of conducting a [[systematic review]] of the literature. In this methodology, data is abstracted by one or several abstractors when conducting a [[meta-analysis]], with errors reduced through dual data abstraction followed by independent checking, known as [[adjudication]].<ref>{{Cite journal |last1=E |first1=
==Abstraction in object oriented programming==
{{
In [[object-oriented programming]] theory,
Various object-oriented programming languages offer similar facilities for abstraction, all to support a general strategy of [[
[[Common Lisp Object System]] or [[Self (programming language)|Self]], for example, feature less of a class-instance distinction and more use of delegation for [[
C++ exemplifies another extreme: it relies heavily on [[generic programming|templates]] and [[method overloading|overloading]] and other static bindings at compile-time, which in turn has certain flexibility problems.
Line 154 ⟶ 137:
If one requires a more differentiated hierarchy of animals – to differentiate, say, those who provide milk from those who provide nothing except meat at the end of their lives – that is an intermediary level of abstraction, probably DairyAnimal (cows, goats) who would eat foods suitable to giving good milk, and MeatAnimal (pigs, steers) who would eat foods to give the best meat-quality.
Such an abstraction could remove the need for the application coder to specify the type of food, so
===Object-oriented design===
{{
Decisions regarding what to abstract and what to keep under the control of the coder become the major concern of object-oriented design and [[___domain analysis]]—actually determining the relevant relationships in the real world is the concern of [[object-oriented analysis and design|object-oriented analysis]] or [[legacy analysis]].
Line 164 ⟶ 147:
==Considerations==
When discussing [[formal semantics of programming languages]], [[formal methods]] or [[abstract interpretation]],
Abstraction may be
Abstractions, however, though not necessarily
The level of abstraction included in a programming language can influence its overall [[usability]]. The [[Cognitive dimensions]] framework includes the concept of ''abstraction gradient'' in a formalism. This framework allows the designer of a programming language to study the trade-offs between abstraction and other characteristics of the design, and how changes in abstraction influence the language usability.
Line 177 ⟶ 160:
==Levels of abstraction==
{{
Computer science commonly presents ''levels'' (or, less commonly, ''layers'') of abstraction, wherein each level represents a different model of the same information and processes, but with varying amounts of detail. Each level uses a system of expression involving a unique set of objects and compositions that apply only to a particular ___domain.
Line 185 ⟶ 168:
===Database systems===
{{
Since many users of database systems lack in-depth familiarity with computer data-structures, database developers often hide complexity through the following levels:
Line 191 ⟶ 174:
[[Image:Data abstraction levels.png|thumb|Data abstraction levels of a database system]]
===Layered architecture===
{{
The ability to provide a [[design]] of different levels of abstraction can
Line 215 ⟶ 198:
* [[Abstract data type]] for an abstract description of a set of data
* [[Algorithm]] for an abstract description of a computational procedure
* [[Data modeling]] for structuring data independent of the processes that use it
* [[Encapsulation (object-oriented programming)|Encapsulation]] for abstractions that hide implementation details
Line 228 ⟶ 210:
==References==
{{Reflist}}
==Further reading==
{{
* {{cite book |
* {{cite web |
* [
* {{cite book |last1=Roberts |
* {{cite web |
*{{Cite journal
| last1=Vishkin |
| date=January 2011 ▼
| journal=Communications of the ACM
| volume=54
| issue=1
▲| date=January 2011
| title=Using simple abstraction to reinvent computing for parallelism
| pages=75–85
Line 250 ⟶ 229:
| doi-access=free
}}
{{
==External links==
* [https://sites.google.com/site/simulationarchitecture/ SimArch] example of layered architecture for distributed simulation systems.
{{Software engineering}}
{{DEFAULTSORT:Abstraction (computer science)}}
[[Category:Data management]]
[[Category:Articles with example Java code]]▼
[[Category:Abstraction]]
[[Category:
[[Category:Object-oriented programming]]
<!-- Hidden categories below -->
▲[[Category:Articles with example Java code]]
[[Category:Articles with example Pascal code]]
|