[Seaside] Re: Menu component - communicating with root component
boris at deepcovelabs.com
Sun Apr 20 22:30:59 UTC 2008
Ah, that's a very good point, so bottom-to-top you would have something
callback: [self announce: (CellClicked cell: self)];
with: self contents.
cells add: cell.
do: [:ann | self announce: ((ann copy) row: self; yourself)].
rows add: row.
do: [:ann | self announce: ((ann copy) table: self; yourself)].
From: seaside-bounces at lists.squeakfoundation.org
[mailto:seaside-bounces at lists.squeakfoundation.org] On Behalf Of Steve
Sent: Sunday, April 20, 2008 3:14 PM
To: Seaside - general discussion
Subject: Re: [Seaside] Re: Menu component - communicating with root
Good example Boris.
Implicit in that is that an announcement can contain more information
than any given announcer may provide. As you extend the containment
hierarchy the announcement can be extended by adding new instVars. Only
those instances that care need to know about them.
This could be done with parent sends but each object traversed needs to
know the protocol
self parent cellClicked: self.
self parent cellClicked: cell inRow: self
If you add another layer of containment and the top level wants to know
about the bottom when then every intervening object needs new protocol
to support the layer. It always felt to us you end up with more protocol
in every possible parent class just to pass state. With the announcement
all of the state is in one object and it feels simpler. If the objects
in the middle just copy all of the state from the announcement they
receive then they don't even have to know about what the child hierarchy
has added, just that they can receive the announcement and how announce
You can't do that with parent send protocol unless you put the state in
some other object - which means you now have an object to hold the same
state as the announcement would anyway, usually in an anonymous way such
as array elements. Using an announcement allows you to name those
elements and pass them in far less brittle way.
seaside mailing list
seaside at lists.squeakfoundation.org
More information about the seaside