CS 228 meeting -*- Outline -*- * Design and Implementaiton of ADTs (HR 9.1) This chapter is a summary and reflection on previous ones ** overview ------------------------------------------ HR CHAPTER 9 DESIGN AND IMPLEMENTAITON OF ADTS Topics: A. How to design an ADT's operations? 1. abstract domain 2. kinds of operations 3. completeness and testability B. How to implement an ADT correctly? 1. Choosing a reprsentation 2. Abstraction map 3. Abstract vs concrete assertions 4. Examples C. How to specify an ADT? 1. Primitive models 2. Non-primitive models (layers) ------------------------------------------ ** review of ADTs recall ------------------------------------------ ABSTRACT DATA TYPES def: an *abstract data type* (ADT) is a type specified by: (1) a set of *abstract values*, and (2) specifications for the *operations* on the values ------------------------------------------ This is essentially a specification ------------------------------------------ def: an *implementation* of an ADT consists of: (1) a data structure that (concretely) represents the abstract values (2) code for the operations that has - the specified interface, and - behaves as specified ------------------------------------------ Q: What's the C++ mechanism for an ADT implementation? a class definition Q: What in C++ defines the data structure representation? the data members Q: What in C++ defines the code for the operations? the member functions emphasize the separation of specification (documentation) and coding