September 09, 2003
Abstract Data Types
Data abstraction, a part of Object Orientated Programming, is a technique used to simplify data structures by focusing only on the important aspects of the data. The implementation details are hidden while the details of the data are grouped together allowing the data to be manipulated as a unit. Abstract Data Types (type abstraction) and Objects (procedural abstraction) are the two primary forms of data abstraction.
An Abstract Data Type (ADT) is a data abstraction that consists of the data structure declaration and the interface describing the data operations. The interface contains operations to create, interrogate, manipulate, and destroy instances of the ADT. The interface should be stable and well defined, with infrequent modifications.
An important principle behind ADTs is data encapsulation. Data encapsulation, sometimes referred to as information hiding, prevents the implementation details of the ADT from being accessed directly. Users of an ADT must use the well defined interface to act on the type.
By forcing access through an interface, programmers can achieve independent development by working on large parts of a project in parallel because the interface that will connect the parts has been standardized. This leads to faster and easier debugging, as an ADT can be tested on its own before integrated into a project. ADTs are also built for re-use. Once the ADT is written, it can be used in any application. Even two ADTs that have different implementations can be interchanged dynamically if their interfaces are the same.
Another advantage of ADTs comes into play when designing algorithms. The interface of the ADT can be used to prove algorithm correctness. Once this is established, frequently used operations can then be identified and work can be done to optimize these common operations, yielding in possibly dramatic performance gains.
Perhaps the most common example of an ADT is a Stack. Tomorrow I will get into the Stack ADT specification and provide an example implementation in ActionScript 2.0, as well as some example usage scenarios.
My next few entries will be all about ADTs and ActionScript 2.0. Stay tuned… there's plenty more to come!

Comments