[Seaside] Wandering Announcements - Design - contd
Keith Hodges
keith_hodges at yahoo.co.uk
Fri Apr 25 09:03:49 UTC 2008
thoughts continued....
I had expressed the idea that a WAComponent was like an infant, unable
to articulate its needs, and unaware of its place in the world. In the
Wandering Announcements model we give each component the ability to
specify what it does know about the world. That is all it is doing, it
is just saying, what the world around it is like, what is above, below
to the left and to the right.
It is up to wandering announcements to make use of these relationships
for routing events. Child components do not explicitly know anything
about their parents. But they do know that they may have a parent, or a
brother, and they can shout, oi Dad, oi Bro', and get a response.
Components implement:
#annParent
#annChildrenIn: block
and hence:
#annSiblingsIn: block
Wandering announcements use these as implicit relationships over which
to wander. Note however that these published relationships need not be
related to the actual component hierarchy.
A chess board, could publish each of its 64 squares as annChildrenIn:
even though in actual fact, it is implemented by 8 x
WAChessBoardRowComponents. This would allow each of the squares to
announce to all 63 of its siblings, even though in the actual component
hierarchy each square only has 7 direct siblings.
There is nothing stopping additional objects that are not in the right
place at the right time to be included as a sibling, they are simply
subscribed to the announcements meant for siblings.
There is nothing stopping more spatial relationships being defined, such
as..
#annBoardSquares
or
#annItemsToMyLeft
or
#annTrainTrackNextPiece
A chess board, has one implementation, a monopoly board has an entirely
different implementation. However a "white knight" could be equally at
home on either and can do things such as.
self announce: (HighlightValidMoves for: self)
I think this preserves the principles that Children dont know explicitly
about their parents, but now they have permission to ask questions of
their surroundings.
ok, now to test this all out!
Keith
More information about the seaside
mailing list