In section 1.1.8, we noted that a procedure function used as an element in creating a more complex procedure function could be regarded not only as a collection of particular operations but also as a procedural functional abstraction. That is, the details of how the procedure function was implemented could be suppressed, and the particular procedure function itself could be replaced by any other procedure function with the same overall behavior. In other words, we could make an abstraction that would separate the way the procedure function would be used from the details of how the procedure function would be implemented in terms of more primitive procedures. functions. The analogous notion for compound data is called data abstraction. Data abstraction is a methodology that enables us to isolate how a compound data object is used from the details of how it is constructed from more primitive data objects.
The basic idea of data abstraction is to structure the programs that are
to use compound data objects so that they operate on
abstract data.
That is, our programs should use data in such
a way as to make no assumptions about the data that are not strictly
necessary for performing the task at hand. At the same time, a
concrete
data representation is defined independent of the
programs that use the data. The interface between these two parts of our
system will be a set of
procedures,
functions,
called
selectors and
constructors, that implement the abstract data in terms of the
concrete representation. To illustrate this technique, we will consider
how to design a set of
procedures
functions
for manipulating rational numbers.