[Seaside] Re: Menu component - communicating with root component

Boris Popov 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

Cell>>renderContentOn: html
 html anchor
  callback: [self announce: (CellClicked cell: self)];
  with: self contents.

Row>>addCell: cell
 cells add: cell.
  when: CellClicked
  do: [:ann | self announce: ((ann copy) row: self; yourself)].

Table>>addRow: row
 rows add: row.
  when: CellClicked
  do: [:ann | self announce: ((ann copy) table: self; yourself)].


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

seaside mailing list
seaside at lists.squeakfoundation.org

More information about the seaside mailing list