Andrew P. Black skrev:
I keep on thinking that Morphic is really elegant and that all of this will one day make sense if only I can learn to squint in the right way. But I'm seriously beginning to wonder ...
Morphic has it's flaws...
The good news is that the final code is really short and sweet, comparing well with the "draw on the raw screen" version that mark Guzdial puts in his book (Package "Boxes" in the same SqueakSource project, if you care to look). The bad news is that it is extremely brittle. I liek telling students to play with stuff an see what happens, and then to figure out why. I get the feeling that changing the order of two statements in this code might just as well precipitate the next revolution as change the stacking order of two Morphs ... and I have _no idea_ why.
OK, so now I'm just venting. But I would really like to know if I'm the only one who feels this way.
No, once you start scratching the surface of Morphic all sorts of stuff starts to show up.
What to do about it? I think that getting rid of TransformationMorphs as wrappers (they are not really decorators, because they are not inserted into the Morphic hierarchy until something needs to be transformed) would help, and instead giving each Morph the ability to transform itself. This would involve a test, of course: myTransformation ifNotNi: [ ... ] which is a tad ugly. This is similar to what was done with Alignment a while back --- giving every Morph the ability to align its submorphs. (However, I think that that change may have been a mistake; adding a separate allignmentMorph to the hierarchy makes much more sense to me than adding a separate TransformationMorph. Moreover, we know that any 2-D affine transformation can be represented as a 3 x 2 matrix, so there can be a single universal implementation of transformations
Morphic transformations were retrofitted and this was kept trough the ages as no one found it compelling enough to refactor Morphic to handle transformations without using the TransformationMorph stuff.
Tweak is next generation Morphic, and is written to handle transformation from the ground up, but it has less users and less documentation etc...
Karl