Abstract View of Data Structures

Description

For abstract data structures two things are important:
  1. The operations working on the data structure.
  2. The current state of the data structure.
It is quite common to provide a number of methods for data structures which perform the essential operations on these data structures. Also, some of the state, e.g. some sort of "size", is exposed to the user. However, often it is necessary to find out more about the current contents of the data structure. For example, the STL adaptor stack does not provide non-destructive access to the elements currently stored in the stack although this is clearly part of the logical concept "stack": It is only possible to get all elements by removing each of the elements in turn. However, in some applications (e.g. during searching a path in a graph) it is useful to get the contents of the stack.

The concept of logical inspectability refers to exposure of all state information of a data structure which is part of it's logic description. For example, the state of a stack is made up of all elements of the stack including their order and the current size of the stack. A stack has methods to push a new element on the stack, to access the current top element, to test whether there are elements stored in the stack and to remove the top element. To expose the whole state of the stack means, that there are also access methods to get all elements of the stack. However, it is not possible to change these elements or to add or remove elements at a different position than the stack's top. Correspondingly, the stack is not required to expose any information about the underlying container used to implement the stack: This can e.g. be a list or a vector but this does not matter for the stack's state.


Copyright © 1999 Dietmar Kühl (dietmar.kuehl@claas-solutions.de)
Claas Solutions GmbH