[Seaside] Re: Menu component - communicating with root component
Steve Aldred
aldreds at velocitynet.com.au
Sun Apr 20 22:14:24 UTC 2008
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.
then
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
it themselves.
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.
cheers
Steve
More information about the seaside
mailing list