file: 02.1.ADTs.txt author: Bob Muller date: January 21, 2014 CS102 Computer Science 102 Spring 2014 Lecture Notes for Week 2 Topics: 0. Review 1. Point and Line ADTs 2. The Stack ADT ----------------------------------------------------------------- Notes: 1. The QUIZ scheduled for Friday has been postponed until further notice. ----------------------------------------------------------------- 0. Review The main items from last week, were: A. When implementing data structures and their associated algorithms we're going to use Liskov's Abstract Data Type (ADT) methodology. ADTs have: - specifications (provided to the user/clients) - implementations (the details of which are hidden from the user/clients) Java supports this approach, albeit imperfectly. We'll use Java - interfaces for ADT specifications (although they don't do everything that ADTs actually require) - classes for ADT implementations (althought they don't do everything that ADTs require either!) B. Java classes have essentially TWO roles: 1. as implementations of ADTs, 2. to otherwise aggregate related definitions, e.g., all of the math functions can be bundled up in a Math class. C. Java has two kinds of types: 1. base types (int, boolean, etc) 2. reference types -- the value of an expression "new ClassName(...)" is allocated in the heap and then referenced by an arrow (or pointer or address) We write down reference types as either interface names or class names. ----------------------------------------------------------------- 1. Point and Line ADTs See the linked zip file: 02.1.PointsAndLines.zip ----------------------------------------------------------------- 2. The Stack ADT Notes to be provided.