[squeak-dev] Observer pattern implementations

Brenda Larcom asparagi at hhhh.org
Tue Jun 4 16:40:34 UTC 2019


Hi Marcel,

That current benchmark makes a big difference in my decision!  Thank you for re-running it.  From your numbers, it’s easy to understand why I was having performance problems before I switched to Announcements (from Object events, I think; it’s been a long time).  I have objects with a large number of dependencies among them, and most times a user changes something, a long cascade of other changes (frequently including changes in dependencies) follows.  Therefore, performance and debuggability are my two most-important selection criteria.  It’s faintly amusing/embarrassing that past-me never benchmarked a typical ratio (for my models) of registering for updates to receiving updates.  I’ll take Signals out for a test drive and see what I think.

Also, I apologize for misspelling your name in my post below.  I try to get names right but slipped up this time.

— Bren

> On Jun 4, 2019, at 2:54 AM, Marcel Taeumel <marcel.taeumel at hpi.de> wrote:
> 
> Hi Brenda,
> 
> I just ran that benchmark again in Squeak Trunk using a recent VM.
> 
> Signals: 22 ms / 2 ms
> Object dependents: 2389 ms / 0 ms
> Object events: 4282 ms / 5 ms
> Announcements: 46 ms / 0 ms
> 
> Best,
> Marcel
>> Am 04.06.2019 02:06:24 schrieb Brenda Larcom <asparagi at hhhh.org>:
>> 
>> I am reviving some old code that relied heavily on Lukas Renggli's implementation of Announcements (many thanks to Lukas). Announcements still loads in Squeak 5.2, but it is marked as no longer maintained on Lukas' site and I cannot find a repository for it anywhere else, which makes me nervous.
>> 
>> Since I am reworking my code, now is the time for me to switch if I'm going to. I searched for alternatives in the Squeak release, in SqueakMap, on the Squeak wiki, and via DuckDuckGo using these search terms:
>> 
>> Observer
>> Dependent (& variations)
>> Publish-Subscribe (& variations)
>> Callback
>> Event Dispatch
>> Self-Addressed Stamped Envelope (& variations)
>> I have identified the following generalized options in this space:
>> 
>> Object dependencies (update, changed) - in stock image
>> Object events (when:send:to:, trigger:) - in stock image
>> Renditions of VisualWorks' Announcements (events are objects)
>> by Lukas Renggli based on Colin Putney's code from OmniBrowser & Vassili Bykov's blog post - not in SqueakMap; loads in 5.2 & passes its tests; as of 2009, Pharo intended to standardize on this implementation, and they have some (extended) Announcements framework in their stock image now
>> AXAnnouncements by Levente Uzonyi and Kósi Balázs - not in SqueakMap; loads in 5.2 & has one warning about a deprecated message in its tests; ported from VW, so maybe there are Cincom copyright issues
>> Signals (callbacks with constraints for usability) by Marcus Taeumel - in SqueakMap on the Web, but not in the catalog seen by SqueakMap Package Loader in 5.2; loads in 5.2 & fails one test
>> Bindings by Tobias Pape (this link doesn't work on Chrome on OS X Mojave; looks like maybe a two-way registration for mutual change updates) - not on SqueakMap; loads in 5.2 but fails its tests
>> Visual Smalltalk Events by Tim Jones (looks like a precursor to or alternative implementation of the Object events that are now in the default image) - in Goodies rather than SqueakMap; does not load in 5.2
>> Wandering Announcements by Keith Hodges (an extension to Lukas' Announcements that looks around nearby parts of a model to locate an object to handle an announcement) - not on SqueakMap; couldn't locate code
>> PostOffice by Peter Smet (looks like an alternative implementation of the Object events that are now in the default image) - not on SqueakMap; couldn't locate code
>> And for completeness, I also found other packages that implement [parts of] this pattern, but are specific to a particular domain that doesn't help me:
>> 
>> Morphic event handling, for handling user interface events
>> OmniBrowser (now deprecated), for internal OmniBrowser events,
>> MQTT client, for subscribing to updates published by IoT devices
>> MVC, for user interfaces
>> I have questions:
>> 
>> Are these all the generalized options for the Observer pattern and the relatives I listed as search terms?
>> Is there anywhere else I should look?
>> Did I describe each option correctly?
>> Does anyone know of a public URL for any of the options whose source or documentation I couldn't find?
>> Are any of these options, to anyone's knowledge, being actively maintained?
>> Is the Squeak community planning to standardize on any of the generalized options?
>> In the absence of additional information, I am leaning towards sticking with Lukas' Announcements, because of the performance comparison chart on the Signals page (which I am assuming is approximately applicable to Lukas' Announcements as well as AXAnnouncements) and Pharo's standardization decision. Is there any reason that is not on the Signals comparision chart for me to prefer some other package?
>> Before you ask, yes, I would definitely like to help the next person by updating the Squeak wiki so that it is easier to find and pick from these alternatives, creating a SqueakMap entry and ConfigurationOf for at least the one I choose, et cetera. I'll post a [DOCS] thread with my specific proposed wiki changes after I get feedback on the accuracy of the data above.
>> 
>> Thank you for reading, and for any assistance you can provide!
>> 
>> -- Bren
>> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190604/b847690d/attachment.html>


More information about the Squeak-dev mailing list