[NEWBIE] Good Morphic Design, communication
bspight at pacbell.net
Tue Jan 7 18:04:06 UTC 2003
I would appreciate any suggestions about good design in Morphic. Thanks.
Here is what I am doing. I have a fairly dumb GoBoardMorph. I want to
use it not just for Go, but for GoMoku, Gonnect, Clobber, and other
games; also for displaying game-related information by mark-up. So it
will interact with various other objects and users. I suppose that there
are various ways of doing this, but what is good Morphic design?
Some objects will basically tell the BoardMorph what to do; for
instance, a Reader that reads game records and replays them. It this
case I think that making the Board an instance variable of the object or
a subMorph will work just fine.
In other cases the user will be playing a game, composing or solving a
problem, making a diagram, etc. The meaning of mouse events, the
messages sent back and forth, and the objects interacted with will
depend on the circumstances. In thinking about all this it seems to me
that the board should stay pretty dumb and the interacting objects
should handle most of the work. In fact, should the board even know who
it is communicating with? Shouldn't the Hand act as gobetween, sending
info and queries from the board to the interested object and vice versa?
Is that good Morphic design?
Another question about using the Hand: At one point there may be the
Board, on top of that a Point, on top of that a Stone, on top of that a
String on Mark. Say that the Hand, above them all, wants to communicate
with only one of them. I guess that it uses #mouseFocus: to select which
one it will communicate with. But how does it know what Morphs are
More information about the Squeak-dev