Design recipe for Java classes, version 3
Analysis and design (i.e. "decide what you want to do")
- Understand the assignment informally and write
down a purpose statement for the class.
- Write a class sketch,
specifying what kinds of information the class needs to
"remember" and what its most important methods should do.
- Write examples of how your
class will be used, with correct answers. This is a good time
to create a testing class.
Coding ("do it")
- Write a class skeleton
- For each method in the class,
Analysis and design (i.e. "decide what you want to do")
- Understand what the method is supposed to do,
and write down a purpose statement for the
method.
- Write a contract for the method
(if you didn't already do this in the class
sketch).
- Write examples of how the method
will be used
(if you didn't already do this in the class
sketch).
Coding ("do it")
- Write a method skeleton
- Add an inventory to the method
skeleton
- Fill in the Function Body
Compiling and testing ("check that you did it right")
- Compile and syntax-check the class.
Since the only things you've changed recently are in this one method,
you should encounter error messages only in this one method.
- Style-check the class (ditto).
- Test and debug the method (it may be
easiest to simply run all the test cases for the whole class).
Compiling and testing ("check that you did it right")
- Do an integration test to
make sure the methods (which have already been tested individually) work
correctly together.
For the next elaboration of this, see version 4.
Last modified:
Fri Feb 20 09:36:08 EST 2009
Stephen Bloch / sbloch@adelphi.edu