Adding Performance Information to ADT Interfaces

The notion of interfaces plays a key role in Abstract Data Types (ADTs). An interface is intended to distinguish clearly between visible aspects of an ADT (i.e., aspects of it necessary to use the ADT), and the hidden aspects of the ADT (i.e., implementat ion of the ADT). Interfaces make it easier to build and maintain complex systems by controlling and structuring dependencies between different components of a system. As embodied in contemporary programming languages like C + + [8] and Ada [6], the visible interface to an ADT includes names of operations for creating objects of that type, as well as other operations on objects of the type. The type signatures of all visible operations are also visible. Users of an ADT are restricted to employ the operations in its interface, and conform to the rules implied by the signatures of the operations. In this paper, we address the following question: What c u r r e n t l y h i d d e n information about an A D T interface does a programmer need in order to compose co r r ec t and efficient programs? In light of our answer to that question, we also ask: How can we automate a programmer's job in producing and maintining algorithms composed from A D T interfaces ? Our research over the last several years in relational abstraction can provide some answers to these questions. It is well known, of course, that the correctness of a program is much more than its type safety. A programmer certainly needs to understand the specification of any operation that is employed how its result is related to its arguments and to the program state, and its side effects, if any. But, beyond such a functional specification, even more information is needed to write efficient programs. We observe that to implement an operation a programmer must often make choices among several alternative correct algorithms that can be writ ten in terms of visible interfaces. These choices generally depend on, among other things, performance properties of these interfaces. Advertising performance properties in an ADT interface enables programmers to make rational choices among alternative implementations of the ADT and to make rational choices among alternative compositions of the ADT's interfaces. However, it does introduce a maintenance dilemma when the performance data are altered, due to maintenance of an ADT implementation, the programmer must decide which functionally correct algorithms should be recoded in order to adapt to the new performance characteristics of the interfaces.