Java Reference
In-Depth Information
Example1.7 We apply the label “hard drive” to a collection of hardware
that manipulates data on a particular type of storage device, and we ap-
ply the label “CPU” to the hardware that controls execution of computer
instructions. These and other labels are gathered together under the label
“computer.” Because even the smallest home computers today have mil-
lions of components, some form of abstraction is necessary to comprehend
how a computer operates.
Consider how you might go about the process of designing a complex computer
program that implements and manipulates an ADT. The ADT is implemented in
one part of the program by a particular data structure. While designing those parts
of the program that use the ADT, you can think in terms of operations on the data
type without concern for the data structure's implementation. Without this ability
to simplify your thinking about a complex program, you would have no hope of
understanding or implementing it.
Example1.8 Consider the design for a relatively simple database system
stored on disk. Typically, records on disk in such a program are accessed
through a buffer pool (see Section 8.3) rather than directly. Variable length
records might use a memory manager (see Section 12.3) to find an appro-
priate location within the disk file to place the record. Multiple index struc-
tures (see Chapter 10) will typically be used to access records in various
ways. Thus, we have a chain of classes, each with its own responsibili-
ties and access privileges. A database query from a user is implemented
by searching an index structure. This index requests access to the record
by means of a request to the buffer pool. If a record is being inserted or
deleted, such a request goes through the memory manager, which in turn
interacts with the buffer pool to gain access to the disk file. A program such
as this is far too complex for nearly any human programmer to keep all of
the details in his or her head at once. The only way to design and imple-
ment such a program is through proper use of abstraction and metaphors.
In object-oriented programming, such abstraction is handled using classes.
Data types have both a logical and a physical form. The definition of the data
type in terms of an ADT is its logical form. The implementation of the data type as
a data structure is its physical form. Figure 1.1 illustrates this relationship between
logical and physical forms for data types. When you implement an ADT, you
are dealing with the physical form of the associated data type. When you use an
ADT elsewhere in your program, you are concerned with the associated data type's
logical form. Some sections of this topic focus on physical implementations for a
 
Search WWH ::




Custom Search