[squeak-dev] New Tutorial on Events in Squeak, Pharo and Cuis
K. K. Subramaniam
kksubbu.ml at gmail.com
Thu Nov 18 15:51:03 UTC 2010
On Tuesday 16 Nov 2010 8:55:52 pm Peter Dinges wrote:
> You can download it from
>
> http://www.elwedgo.de/fileadmin/events_in_smalltalk.pdf
>
> I would greatly appreciate any comments, ideas, or corrections.
Good stuff. You should add it to squeak wiki so that you can directly link
terms to their wiki entries.
when:send:to: and changed/update are used for different situations. WS is used
when event listeners are known apriori and the listener is interested in the
happening. Changed/update is used when they are unknown and the listener is
interested in the state change caused by the event.
For instance, when up key is pressed in a list, the listener is well known and
interested only in the happening of key press. WS is ideal for this case. On
the other hand, when a value in viewer is changed, an unknown number of
watchers need to read the new value. This would be a case for changed/update.
Of course, we could use a WS when the watcher is created but it wouldn't be
simple.
In your CU example, Alice would be an instance of Dresser and Bob will be an
instance of Eater, where Dresser and Eater are subclasses of Person. Alice
would wear office dress if the alarm went off in the morning or an evening dress
if it went off in the evening.
Subbu
More information about the Squeak-dev
mailing list
|