Abstract Data Types (ADTs)
We start by considering what an Abstract Data Type is. The National Institute of Standards and Technology defines an Abstract Data Type as:
A set of data values and associated operations that are precisely specified independent of any particular implementation.
We can think of ADTs as a kind of data abstraction where a type's internal form is hidden behind a set of access functions. Values of the type are created and inspected only by calls to these access functions. This allows the implementation of the type to be changed without requiring any changes outside the module in which it is defined.
Objects and ADTs are both forms of data abstraction, but objects are not always ADTs. Objects use procedural abstraction (methods), not type abstraction:
- An ADT is considered abstract because the operations performed on it are separated from the underlying implementation
- Most data-structure ADTs can be implemented using either a contiguous (array-based) or linked-data representation
- An ADT hides the implementation of a data structure behind a well-defined interface.
An ADT can be represented diagrammatically: