4  Tuesday Afternoon:

4.1  Goals

Design recipes for methods for simple classes and classes with containment.

Design recipe for methods:

  1. analyze the problem & identify the classes of data (with examples)

  2. formulate a purpose statement and a contract

  3. make up examples of the method invocation - with expected outcomes

  4. create the template: what information exists to compute the desired result?

  5. program

  6. turn the examples into a test suite

We will think carefully about the structure of the templates for each kind of problems:

This leads to deciding whether the method for a union of classes should be defined as an abstract method or a concrete method in the abstract class.