Abstract Data Types

Abstract data types (ADTs) are a generalization of the primitive data types (e.g., integer, real, boolean) supported by most programming languages. An ADT encapsulates the state (i.e., variables) needed to represent the abstract type, and a set of operations on that type.

Example of an ADT String:

      CONST MAXSTRING = 5000;
      (* string is an index into the string space *)
      TYPE string = integer;
      VAR stringspace = ARRAY 1:MAXSTRING of char;
      CREATE(var s:string);
      DELETE(var s:string);
      APPEND(letter:char; var s:string);
      CONCATENATE(s1,s2:string; var s3:string);
      

Important properties of an abstract data type include: