[Cuis] #when:send:to:

KenD Ken.Dickey at Whidbey.com
Fri Nov 13 20:33:24 CST 2015


On Fri, 13 Nov 2015 12:58:22 -0500
"Dan Norton" <dnorton at mindspring.com> wrote:

> 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.

Dan,

Good start.

I would suggest a deeper example.

Lights could be a model with a presenter (LightPanel) which shows the lights.  E.g. open a layout morph with a row of elipses (circles) which are red/green (or whatever) for off/on.

Clicking on a light changes the model (Lights subclass ActiveModel), which signals 
  triggerEvent: #colorChange with: aColor.

You can look in Morphic-Misc1 at RadioButtonMorph to see how to handle clicks.

Workspace code could also turn off/on or just toggle lights in the model, with the LightPanel presenter updating appropriately.

One can then add a bit of wackyness, like using different colors than red/green and the presenter will show the proper color..

$0.02.
-KenD 




More information about the Cuis mailing list