Workshop
本页目录· 4 条
9.1 Activity: Nouns and Verbs technique
Read the specification provided in the text file opposite.
Task 1
In groups, step through the specification and write down as many nouns and verbs as you can find.
- A noun is a word that refers to a thing/object, person, animal, place, or idea.
- A verb is a word that is used to describe an action or occurrence.
For example, in the sentence: "Kim likes to write programs", the words Kim and programs are both nouns, and the words likes and write are both verbs.
Task 2
Nouns tend to correspond with classes/objects, or with properties of an object. Look through your list of nouns and decide which ones might correspond to classes in your program design, and which ones might be fields belonging to those classes.
Verbs tend to correspond with actions that an object needs to be able to perform. Look through your list of verbs and decide which ones will need to be methods in your program design.
Group together sets of nouns and verbs that are related, and use your groupings to decide what responsibilities each class will have. Discuss which classes would need to interact with each other, and how they would interact.
Answer
9.2 Activity: CRC and Scenario techniques
Read the specification provided in the text file opposite.
Task 1
In groups, step through the specification and identify the different classes you would need in your program design. Give each class an appropriate name.
For each separate class, write down:
- an outline of the key responsibilities of that class, and
- a list of any other classes that will be collaborators of that class.
Keep your descriptions as simple and high-level as possible — it is important to keep the principles of abstraction in mind at this stage of the design process.
Task 2
Think of an example scenario that might take place in your public transportation system. Brainstorm as many possible actions as you can that might take place in the system, including potential situations where things might go wrong. Write out the scenario step-by-step, including as much detail as possible.
Did your scenario highlight any situations that might not be adequately handled by the program design you came up with in Task 1? Are there any additional classes or class responsibilities that you need to add? Modify your Task 1 design as needed, based on the discoveries you made from stepping through the scenario.