Data abstraction separates :

  • What you can do with data from
  • How it is represented

ADT is to separates:

  • Specification 
    • What kind of thing we're working with and what operations can be performed on it.
  • Implementation 
    • How the thing and its operations are actually implemented

An abstract data type (ADT) consists of the following:

  • collection of data
  • A set of operations on the data or subsets of the data
  • A set of axioms, or rules of behavior governing the interaction of operations

Examples:

  • Stack:
    • operations are "push an item onto the stack", "pop an item from the stack"; implementation may be as an array or linked list or whatever.
  • queue:
    • Operations are "add to the end of the queue", "delete from the beginning of the queue"; implementation may be as an array or linked list or heap.

 

Abstract Data Types (ADT)

  • Operations on objects of the type are those provided by the abstraction

  • Implementation is hidden

Two parts of ADT:

  1. The public (or external) part, which consists of:
    • the conceptual picture
      • the user's view of what the object looks like,
      • how the structure is organized
    • the conceptual operations (what the user can do to the ADT)
  2. The private (or internal )part, which consists of:
    • the representation
      • how the structure is actually stored
    • the implementation of the operations

 

Abstract Data Types are a way to encapsulate and hide the implementation of a data structure, while presenting a clean interface to other programmers.

Some more examples: 

Data type Set of values Examples of operations
Color​ three 8-bit integers get red component, brighten
Picture 2D array of colors get/set color of pixel (i, j)
String sequence of characters length, substring, compare