Richard Gesick Abstraction the mechanism and practice of abstraction reduces and factors out details so that one can focus on a few concepts at a time The concept originated by analogy with abstraction in ID: 458642
Download Presentation The PPT/PDF document "Abstraction" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Abstraction
Richard GesickSlide2
Abstraction
the mechanism and practice of
abstraction
reduces and factors out details so that one can focus on a few concepts at a timeSlide3
The concept
originated by analogy with abstraction in
mathematics
in both computing and in mathematics, numbers are concepts in the programming languages, as
found
in mathematics.
Implementation details depend on the hardware and software, but this is not a
restrictionSlide4
Data and Control Abstraction
Control abstraction
is the abstraction of
actions
Control abstraction involves the use of subprograms and related concepts control flows
data abstraction
is that of data
structures
allows handling data bits in meaningful ways. For example, it is the basic motivation behind datatypeSlide5
objects
an attempt to combine abstractions of data and code.Slide6
Abstraction in programming languages
Different programming languages provide different types of
abstraction
In object-oriented programming
languages
the concept of
abstraction
has itself become a declarative statement - using the keywords
virtual
or
abstract
and
interface
.
After such a declaration, it is the responsibility of the programmer to implement a class to instantiate the object of the declaration.Slide7
Abstraction in programming languages
Functional programming languages commonly exhibit abstractions related to
functions
lambda
abstractions (making a term into a function of some variable), higher-order functions (parameters are functions), bracket abstraction (making a term into a function of a variable).Slide8
Specification languages
Specification languages generally rely on
abstractions
specifications
are typically defined earlier in a project, (and at a more abstract level) than an eventual implementation.
The
UML specification language,
allows
the definition of
abstract
classes,
remain
abstract during the architecture and specification phase of the project.Slide9
Control Abstraction
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. Slide10
a = (1 + 2) * 5
Without control abstraction,
a
programmer would need to specify
all
the register/binary-level steps each time
he/she
simply wanted to add or multiply a couple of numbers and assign the result to a variable.
Such
duplication of effort has two serious negative consequences:
it forces the programmer to constantly repeat fairly common tasks every time a similar operation is needed
it forces the programmer to program for the particular hardware and instruction setSlide11
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 privateSlide12
Data Abstraction
one could define an abstract data type called
lookup table
which uniquely associates
keys
with
values
, and in which values may be retrieved by specifying their corresponding keys.
Such
a lookup table may be implemented
as
a hash table, a binary search tree, or even a simple linear list of (
key:value
) pairs.
the
abstract properties of the type are the same in each caseSlide13
In object-oriented programming
abstraction
involves the facility to define
objects
that represent abstract "
actors“
that can perform work, report on and change their state, and "communicate" with other objects in the system