Eventually, BottomFeeder will be moved to Pollock. In the meantime, a simple step on the way there is converting all the change/update code to use trigger events. This is actually fairly simple - I suppose I could have used the RB's rewrite tools to do it. It's a fairly simple task, and in the process I cleaned up a lot of dangling hooks that had crept into my code. So what's the change look like?
Well, the old code might have looked like this:
in RSSFeedViewer
initialize
....
self feedManager addDependent: self.
update: anAspect with: aValue from: anObject
self perform: anAspect with: aValue.
and the model might kick it off by doing:
in RSSFeedManager
addedNewContent: content
self changed: #addedNewContent with: content
So what changes? Well, I removed all the dependency hooks. I changed all the self changed: #foo code to read self triggerEvent: #foo instead. Then instead of adding a dependency, I hooked the events:
In RSSFeedViewer
postOpenWith: bldr.
...
self feedManager when: #addedNewContent: send: #addedNewContent: to: self
That leaves cleanup. In the old code, I just sent self feedManager removeDependent: self. Now, I just send self feedManager removeAllActionsWithReceiver: self. That's pretty much it. Now, the interesting thing was that doing this helped me find bugs. It turned out that I was adding multiple dependencies during execution - and doing this exercise helped me find those problems and fix them. The result should be a cleaner application, with easier to understand code. Which is, IMHO, far more important than the fact that it makes my code more Pollock ready.