Definition of an Abstract Data Type (ADT)
Abstraction
An abstraction is some category of processes or objects that can be
characterized by only a subset of its attributes. All the non-essential
attributes are hidded (abstracted) away.
There are two kinds of abstraction in CS.
- Process Abstraction - subprograms - have the name and parameter list and
know what is to be returned. Knowing HOW the subprogram is a hidden
detail.
- Data Abstraction - given the name of the abstraction and the functions
to manipulate it, the details of HOW the it is implemented are hidden and
unnecessary to its correct use. For example, given the ADT stack, and a
few functions like push() and pop(), you can use the stack idea without
knowing whether the stack is implemented as an array or a linked list.
Abstract data types must satisfy two conditions, encapsulation and
information hidding.
Encapsulation
The representation, or definition, or the type and the operations on objects
of that type are contained in a single syntatic unit. Also, other
program units must be able to create objects of the defined type.
Information Hiding
The representation of the objects of the defined type are hidden from the
program units that use the type, so that the only direct operations
possible on those objects are those provided in the type's description.
I.e. the functions provided within the encapsulation. The push() function
for a stack would "act" on the array or linked list. The user of the
stack would NOT be able to write code dependent on the actual representation.
Instantiation
You must be able to declare multiple instances of the type. (I.e. Declare
variables of the type.)