[Cuis] #when:send:to:
Dan Norton
dnorton at mindspring.com
Fri Nov 13 11:58:22 CST 2015
Hello Everyone,
The following repo contains before and after examples of replacing the Dependency
Mechanism with the Observer Pattern:
https://github.com/dhnorton/Cuis-Smalltalk-light
Please take a look at this and tell me what needs to change. I'm trying to supply an example
of the Observer Pattern so that others might use #when:send:to: with less difficulty than I
experienced. There may be better examples but I picked one from the Blue Book.
It seems that #when:send:to: is necessary but not sufficient as a replacement for the
Dependency Mechanism. In this example, it replaced #addDependent:, not #changed or
#update and I am still not comfortable with how to choose the parameters. This may be an
example of the difficulty in explaining the obvious, I'm not sure :-)
The #changed method was replaced with #triggerEvent: with a symbol argument which is
referred to in one of the arguments of #when:send:to: and that's the only constraint AFAICT.
The #update: method was retained, as a convenience; it also needs to agree with one of the
arguments of #when:send:to: and could have been different.
Please tell me if any of this is wrong. Thanks.
- Dan
More information about the Cuis
mailing list