The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Eventful Stuff

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Eventful Stuff Posted: May 25, 2004 9:22 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Eventful Stuff
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Travis Griggs - Blog

Advertisement
I was intrigued by Rich Demers comments in Moving to Events from change/update . If I understand him correctly, we're doing basically the same thing, which means that for once, one of my ideas wasn't at least totally crazy (watch Rich recant now).

The idea is that, having symbols for event names embedded throughout your object makes it kind of hard to tell what it can do. Sure, there's eventsTriggered, but that doesn't tell you how they usually get triggered. So a protocol such as 'my events' is created. For example:

MyClass methodsFor: 'accessing'
foo: aBar
	foo := aBar.
	self triggerFoo: foo.

MyClass methodsFor: 'my events'
triggerFoo: aBar
	self triggerEvent: #foo with: aBar

In this way, I can quickly browse the events triggered (they're embedded in the method names) AND how they're usually triggered (i.e. with or without an argument). I didn't do this at first; I found keeping track of what events were possible was a pain. Having adopted this convention, I find things much easier to keep track of.

Do you use strong event checking, or weak? Did you know you can turn it on or off? By default it's off. Let's say your class triggers an event called #activated. You're coding along a couple of days later and you want to subscribe to that event. You remember its name basically, but memory being what it is, you remeber it as #activating, minor spelling difference. You hook it up. And then you try to figure out why your code isn't working. It's not working because you setup a handler on an event that's never going to happen. There's a class side method called ambivalentEventChecking which you can override to false (it's a double negative sort of thing). Doing so is very handy. It causes the subscribee to check its known events before setting up a handler. This keeps the above situation from happening. I always override ambivalentEventChecking to return false. I wish the default were set to true, er, uh, false.

Finally, I wonder if others are aware of the EventModels package in the Open Repository? This is basically a modularization of a piece of the Pollock framework. Pollock spawned the creation of things similiar to those found in the existing VisualWorks ValueModel heirarchy, but based around triggered events and kind of clean room implemented. Sames did a pretty good job. You don't need to use Pollock to find these alternate ValueModel thingies handy. I use them in quite a few places. The idea behind factoring EventModels away from Pollock was to allow people to begin using them independent of whether they're using the Pollock Widgets Framework or not. It also allows one to begin to incrementally prepare existing applications to be Pollock-ized. One of the nice things about the ObservedValue, is that it triggers a different kind of event both before AND after it changes. The old framework didn't send out the before notifications.

Read: Eventful Stuff

Topic: Software values Previous Topic   Next Topic Topic: ESPN Feeds

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use