Designing the part
When you create a VA Smalltalk part, you are actually creating a Smalltalk class. You can think of a class as a template for creating new objects. When you design the class, you decide what instance variables and methods the class will have, and you decide which of these instance variables and methods are made public to other parts. The instance variables that are visible to other parts are called attributes; the methods that are made visible to other parts are called actions.
In this example, you will build a class that represents a timer object. The timer will run for a certain length of time, and then it will notify other parts that it has expired. You could use the timer in applications to remind a user to enter data, or to close a window after it has displayed for a few seconds. The timer has the following instance variables:
length
The number of milliseconds that will elapse before the timer expires
repeat
A flag that indicates whether or not the timer starts again after it expires
timer
A private variable that holds the identity of the timer
The timer has the following methods:
start
Starts the timer
stop
Stops the timer
eventTimerFired:
A private method that is called whenever the timer's length of time elapses
length
Gets the length instance variable
length:
Sets the length instance variable
repeat
Gets the repeat instance variable
repeat:
Sets the repeat instance variable
Last modified date: 01/29/2015