Designing the part
When you design a VA Smalltalk part, you are really designing a class. You can think of a class as a cookie-cutter, or template, for creating new objects. It is your job to define the attributes the objects in your class have (their instance variables), and what actions they can do (their methods).
In this example, you define a class for creating a runner object. The class has the following attributes:
number
A number assigned for the race and displayed on the runner's jersey
finishTime
A finish time recorded when the runner completes the race
asResultString
A string displaying the total time it took the runner to complete the race
The runner can do the actions displayed around the perimeter of the figure:
number
Answer the number assigned to the runner for the race.
number:
Remember, or store, the number assigned to the runner for the race.
finishTime
Answer what time the runner completed the race.
finishTime:
Remember, or store, what time the runner completed the race.
asResultString
Answer a string displaying the total time it took the runner to complete the race.
This kind of figure, with attributes in the center and actions around the perimeter, is commonly used to design classes. You can sketch these class designs on index cards, one class per card. This allows you to easily throw away one design in favor of another. You can also arrange the cards, or classes, into a hierarchy, until you are confident of your design.
Last modified date: 07/15/2020