Summary of Nouns and Verbs

Here is a summary of the steps we just learned:

Nouns

  1. Write down all the nouns and nouns phrases.

  2. Analize the nouns. Look for the classes and data members. If it's not clear, skip it for now!

  3. Pick one class to work on at a time.

  4. Brainstorm on nouns again related to the class you have chosen to work on at a time. Double check your instance variables with "hasa".

  5. Start coding the class. Use the class name, followed by a .java extension for your source file.

    1. Type in the class name.
    2. Type in the instance variable names. Make them private.
    3. Determine the classes for the data members and type that in.

  6. Next, design and write the signatures for the access methods. Make them public. As a good rule of thumb, write an access function for each instance variable. Then, write the code for the methods. An access method typically just returns the instance variable.

  7. Now analyze the class to determine the constructors. Design the signatures for the constructors. As a minumum, start with the default constructor. Write the code for the constructor(s).

  8. Write your test program to start testing your class. Make sure you test every constructor and every access function. Fix any errors before going on. As you think of additional instance variables, constructors or other methods related to accessing the instance variables, design, code, and test them.

In-Between

  1. Design and write set-methods that allow the object to be changed. A good rule of thumb is to write one that takes a value for each instance variable and also write an additional one for setting each individual value separately. Only write the ones that make sense. Test them before going on.

  2. Every object should be able to display itself, so write the toString() method and a print method that prints the values of the object to System.out. Test these thoroughly before continuing.

  3. If it makes sense for the object to display itself graphically, write a paint() method that draw the object. Test it.

  4. Design, write, and test any other methods related to setting or displaying the object before continuing to the full-blown verb analysis.

Verbs

  1. Write down all the verbs and verb phrases that you have not already taken care of.

  2. Analyze the verbs and determine the behaviors that should be encapsulated in your class. Concentrate on only the most essential ones.

  3. Design and code the most essential method that is the simplest. Try to re-use the methods you have already written. Test it thoroughly.

  4. Do each verb on at a time - design, code, and test each method before working on the next one.

  5. Make sure your class passes your test plan.

After your class has been thoroughly tested, start working on the program (application or Applet) that uses the class.