In
software engineering and
computer science
Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includin ...
, abstraction is:
* The process of removing or generalizing physical, spatial, or temporal details
or
attributes in the study of objects or
systems to focus attention on details of greater importance;
it is similar in nature to the process of
generalization;
* the creation of
abstract
Abstract may refer to:
* ''Abstract'' (album), 1962 album by Joe Harriott
* Abstract of title a summary of the documents affecting title to parcel of land
* Abstract (law), a summary of a legal document
* Abstract (summary), in academic publishi ...
concept
Concepts are defined as abstract ideas. They are understood to be the fundamental building blocks of the concept behind principles, thoughts and beliefs.
They play an important role in all aspects of cognition. As such, concepts are studied by s ...
-
objects by mirroring common features or attributes of various non-abstract objects or systems of study
[ – the result of the process of abstraction.
Abstraction, in general, is a fundamental concept in computer science and software development. The process of abstraction can also be referred to as modeling and is closely related to the concepts of '']theory
A theory is a rational type of abstract thinking about a phenomenon, or the results of such thinking. The process of contemplative and rational thinking is often associated with such processes as observational study or research. Theories may ...
'' and '' design''. Models can also be considered types of abstractions per their generalization of aspects of reality.
Abstraction in computer science is closely related to abstraction in mathematics due to their common focus on building abstractions as objects,[ but is also related to other notions of abstraction used in other fields such as art.][
Abstractions may also refer to real-world objects and systems, rules of computational systems or rules of programming languages that carry or utilize features of abstraction itself, such as:
* the usage of data types to perform ''data abstraction'' to separate usage from working representations of data structures within ]programs
Program, programme, programmer, or programming may refer to:
Business and management
* Program management, the process of managing several related projects
* Time management
* Program, a part of planning
Arts and entertainment Audio
* Programm ...
;
* the concept of procedures, functions, or subroutines which represent a specific of implementing control flow
In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an '' ...
in programs;
* the rules commonly named "abstraction" that generalize expressions using free and bound variables in the various versions of lambda calculus;
* the usage of S-expressions as an abstraction of data structures and programs in the Lisp programming language
Lisp (historically LISP) is a family of programming languages with a long history and a distinctive, fully parenthesized prefix notation.
Originally specified in 1960, Lisp is the second-oldest high-level programming language still in common ...
;
* the process of reorganizing common behavior from non-abstract classes into "abstract classes" using inheritance to abstract over sub-classes as seen in the object-oriented C++ and Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
programming languages.
Rationale
Computing mostly operates independently of the concrete world. The hardware implements a model of computation
In computer science, and more specifically in computability theory and computational complexity theory, a model of computation is a model which describes how an output of a mathematical function is computed given an input. A model describes h ...
that is interchangeable with others. The software is structured in architecture
Architecture is the art and technique of designing and building, as distinguished from the skills associated with construction. It is both the process and the product of sketching, conceiving, planning, designing, and constructing buildings ...
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
A computer language is a formal language used to communicate with a computer. Types of computer languages include:
* Construction language – all forms of communication by which a human can specify an executable problem solution to a compu ...
s'' can be processed with a computer. An example of this abstraction process is the generational development of programming languages from the machine language to the assembly language and the 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
A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled.
A scripti ...
s and domain-specific programming languages.
Within a programming language, some features let the programmer create new abstractions. These include subroutines, modules, polymorphism
Polymorphism, polymorphic, polymorph, polymorphous, or polymorphy may refer to:
Computing
* Polymorphism (computer science), the ability in programming to present the same programming interface for differing underlying forms
* Ad hoc polymorphis ...
, and software components. Some other abstractions such as software design pattern
In software engineering, a software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design. It is not a finished design that can be transformed directly into source or machine c ...
s and architectural styles remain invisible to a 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 Leakey may refer to:
*Leakey, Texas, U.S., a city
*Leakey (crater), a lunar impact crater
*Leakey (surname)
*7958 Leakey, an asteroid
*Leakey Independent School District, a public school district based in Leakey, Texas
See also
*Leak (disambiguati ...
'' – that they can never completely hide the details below; 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.
Abstraction 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 languages such as C++, Object Pascal, or Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
, the concept of abstraction has itself become a declarative statement – using the syntax ''function''(''parameters'') = 0;
(in C++) or the keywords ''abstract
'' and ''interface
'' (in Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
). After such a declaration, it is the responsibility of the programmer to implement a class to instantiate the object of the declaration.
* Functional programming languages commonly exhibit abstractions related to functions, such as lambda abstractions (making a term into a function of some variable) and higher-order functions (parameters are functions).
* Modern members of the Lisp programming language family such as Clojure, Scheme and Common Lisp support macro systems to allow syntactic abstraction. Other programming languages such as Scala also have macros, or very similar metaprogramming features (for example, Haskell has Template Haskell
Template Haskell is an experimental language extension to the Haskell programming language implemented in the Glasgow Haskell Compiler (version 6 and later). In early incarnations it was also known as Template Meta-Haskell.
It allows compile-tim ...
, and OCaml has MetaOCaml). These can allow a programmer to eliminate