Guidelines to Adopt when Developing Abstract Data Types for Reuse

This guidelines give you some hints as to what facilities should be provided by abstract data types developed for reuse.

  1. An operation should be included to create and initialize instances of the abstract data type.

  2. For each attribute of the abstract type, access and constructor functions should be provided. Access functions return attribute values; constructor functions allow attribute values to be changed.

  3. Operations to print instances of the type and to read and write instances to and from filestore should be provided.

  4. Assignment and equality operations should be provided.

  5. For every possible exception condition which might occur in type operations, a test function should be provided which allows that condition to be checked for before initiating the operation.

  6. If the abstract type is a composite type, operations to add objects to and to delete objects from the collection should be provided. If the object is ordered, multiple add and delete functions should be provided. For example, for a list type, operations should be available to add and to delete an element to and from the front and the end of the list.

  7. If the abstract type is a composite type, functions to provide information about attributes of the composition (such as size) should be provided.

  8. If the abstract type is a composite type, an iterator should be provided which allows each element of the type to be visited.

  9. Wherever possible, abstract types should be parameterized using generic types.


Sommerville, I.: Software Engineering. 3rd Edition, Addison-Wesley Publishing Company, Workingham/England, 1990.