TeachJava!
The Java Design Recipe
- Define the data.
- Determine what forms of data will the program process?
- Write precise definitions for each such form of data.
- Implement these definitions as classes. Include constructors,
definitions of appropriate toString methods.
- Define examples of each form of data in the main() method of
the corresponding class; for mixed include representatives for each different
form
- Use these examples to test your constructors and toString() methods
- For each program operation, determine the form of
data processed by the operation.
Include a method for the operation
in the class(es) defining that form of data.
- For each such method, write a contract specifying what the
operation requires and what it produces.
- For each program operation, give a collection of examples
specifying how you expect that operation to behave. Write these
examples as test cases in the main method of the class containing the
operation.
- For each program operation select an appropriate template,
recognizing that self references in the class of the method
suggest that recursive delegation is appropriate.
- Test each method using the the examples
from step 4 and additional examples suggested by issues that arose
during coding.