0% found this document useful (0 votes)
32 views

Abstract Data Types: Maria Cristina A. Magon

The document discusses abstract data types (ADTs). It defines ADTs as data types that are defined by their operations rather than their specific implementation. ADTs encapsulate both a data structure and the functions used to manipulate that data structure. This allows the inner workings to be hidden from users, who only interact with the ADT through its defined interface and operations. The document provides examples of how common systems like cars and computers can be thought of as ADTs.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Abstract Data Types: Maria Cristina A. Magon

The document discusses abstract data types (ADTs). It defines ADTs as data types that are defined by their operations rather than their specific implementation. ADTs encapsulate both a data structure and the functions used to manipulate that data structure. This allows the inner workings to be hidden from users, who only interact with the ADT through its defined interface and operations. The document provides examples of how common systems like cars and computers can be thought of as ADTs.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

ABSTRACT DATA

TYPES

MARIA CRISTINA A. MAGON


(INSTRUCTOR)
TWO IMPORTANT THINGS
ABOUT DATA TYPES

1. defines a certain domain of values


2. defines operations allowed on those
values
Example:
float type
- takes only floating point values
- operations: addition, subtraction,
ABSTRACT DATA TYPES (ADT)

 defines in terms of its data items and


associated operations , not its
implementation
 ADTs are like user defined data types which
defines operations on values using functions
without specifying what is there inside the
function and the operations are performed.
Abstract Data Types
Data abstraction, or abstract data types, is a
programming methodology where one
defines not only the data structure to be used,
but the processes to manipulate the structure
like process abstraction, ADTs can be supported
directly by programming languages
ABSTRACT DATA TYPES (ADT)

Think of ADT as a black box which hides


the inner structure and design of the data
type from the user
It hides all the implementation details from
us
ADT Design Issues
Encapsulation: it must be possible to
define a unit that contains a data structure
and the subprograms that access
(manipulate) it
design issues:
will ADT access be restricted through
pointers?
can ADTs be parameterized (size and/or type
of data being stored)?
Abstract Data Types
To support it, there needs to be mechanisms for
defining data structures
encapsulation of data structures and their routines to
manipulate the structures into one unit
by placing all definitions in one unit, it can be
compiled at one time
information hiding to protect the data structure from
outside interference or manipulation
the data structure should only be accessible from code
encapsulated with it so that the structure is hidden and
protected from the outside
objects are one way to implement ADTs, but because
objects have additional properties, we defer discussion
of them until the next chapter
ADT Design Issues
Information hiding: controlling access to the
data structure through some form of interface
so that it cannot be directly manipulated by
external code
often implemented via two sections of code
public part (interface) constitutes those
elements that can be accessed externally (often
limited to subprograms and constants)
private part, which remains secure because it is
only accessible by subprograms of the ADT
itself
RESERVATION SYSTEM

DATA
OPERATIONS
Example:
When operating a car, the primary activities are steering,
accelerating, and braking. On nearly all passenger cars,
you steer by turning the steering wheel, accelerate by
pushing the gas pedal, and brake by pushing the brake
pedal. This design for cars can be viewed as an ADT
with operations "steer", "accelerate", and "brake". Two
cars might implement these operations in radically
different ways, say with different types of engine, or
front- versus rear-wheel drive. Yet, most drivers can
operate many different cars because the ADT presents a
uniform method of operation that does not require the
driver to understand the specifics of any particular
Example:
We apply the label "hard drive" to a collection of
hardware that manipulates data on a particular
type of storage device, and we apply 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 millions of components, some form of
abstraction is necessary to comprehend how a
computer operates.

You might also like