[squeak-dev] New Tutorial on Events in Squeak, Pharo and Cuis
Juan Vuletich
juan at jvuletich.org
Thu Nov 18 03:10:46 UTC 2010
Peter Dinges wrote:
> Hello everyone,
>
> I recently started to study Morphic and its implementation in Squeak, Pharo,
> and mostly Cuis. Reading through the code, I noticed that there currently are
> three implementations of "events". All of them are mechanisms to signal state
> changes; two are very generic, the third specializes in Morphic input.
>
> Slightly confused by the many meanings of "event", I began to sort the
> different parts and assign them unique names. The result of this process is a
> short tutorial on Events in Squeak, Pharo, and Cuis. It might reduce confusion
> for people starting their tour through the code, or simply help when using
> events in own projects.
>
> You can download it from
>
> http://www.elwedgo.de/fileadmin/events_in_smalltalk.pdf
>
> I would greatly appreciate any comments, ideas, or corrections.
>
> Thanks and have a good day,
> Peter
>
Hi Peter,
Nice writing, thank you! Just a few comments.
- #when:send:to: and #changed/#update serve a similar purpose, and only
one of them is really needed. Their main use is to reflect model changes
in user interfaces. For instance, PluggableMorphs use #changed/#update
and LightWidgets use #when:send:to: for this.
- At the implementation notes of #changed/#update you forgot about class
Model.
- At the implementation notes of #when:send:to: you didn't mention that
ActiveModel is an optimization, using own actionMap instance variable
and not the dictionary in the class side. This optimization is not
unlike the one in Model.
- MorphicEvents are really something really different... They are not
message sends, but objects. This is not an implementation of the
observer pattern, there is no mechanism for message delivery. Instead,
MorphicEvents are stateful objects that are sent around until handled.
- You forgot the AbstractEvent hierarchy. While this is not as general
as #when:send:to: and #changed/#update, it is closer to them than
MorphicEvents are. AbstractEvent is used to notify various Smalltalk
tools of system changes.
I hope you find these comments useful on your journey. Please keep your
document updated with further explorations!
Cheers,
Juan Vuletich
More information about the Squeak-dev
mailing list
|