What is the proper way to program with Morphic?
David N. Smith (IBM)
dnsmith at watson.ibm.com
Mon Nov 8 23:46:28 UTC 1999
At 13:27 -0500 11/2/99, David N. Smith \(IBM\) wrote:
>Can someone point me to an example or two that shows the proper way
>to program in morphic? There are lots of examples, but it's not
>clear which are true morphic ways, which have some MVC left by
>accident, which are written by someone exploring things, and which
>do it the 'right' way.
>
>There are a few plugable morphic classes; are these for
>compatibility with MVC applications only?
>
>I have written one morphic application, a client, that works fine
>but I'm not at all sure if the program structure is at all what it
>should be.
Well, I've found a frequent coding technique that bothers me: using
#initialize to open the morph.
This makes it impossible to subclass the morphic class and change
existing defaults since there is no possible way to send #initialize
to super: do it before and the morph is open with the parents
defaults, and do it after the parent overrides the changed
initializations.
I first found this a problem when I wanted to change the default
colors in the tile game. I found some were too vivid and made it hard
to 'see' some others. I checked a dozen other places and found the
same coding technique.
Is this a standard morph coding technique? If so, why? Couldn't the
opening code be put into an #open method which is always sent just
after #initialize?
Dave
_______________________________
David N. Smith
IBM T J Watson Research Center
Hawthorne, NY
_______________________________
Any opinions or recommendations
herein are those of the author
and not of his employer.
More information about the Squeak-dev
mailing list
|