[Pharo-project] About SimpleMorphic

Igor Stasenko siguctua at gmail.com
Sun Nov 7 19:41:28 CET 2010


On 7 November 2010 05:17, Juan Vuletich <juan at jvuletich.org> wrote:
> Hi Folks,
>
> I apologize for not answering the original messages properly, I had mail
> deliver disabled, so I can't. I have enabled it, so I'll answer properly
> from now on.
>
> To Hillarie:
> If you don't use Polymorph, but want to build your own Morphs from scratch,
> SimpleMorphic is simpler, easier to understand, tweak and fix.
>
>
> To Doru:
> Let's do a comparison:
>
> Size of 4 core classes (Morph, MorphExtension, PasteUpMorph and WorldState)
> Pharo / Squeak / Cuis
> totalIvars:  39 / 46 / 26
> totalClassVars: 15 / 10 / 5
> totalInstMethods: 1170 / 1764 / 663
> totalClassMethods: 55 / 71 / 16
>
> Size of the whole Morph hierarchy
> Pharo / Squeak / Cuis
> totalClasses: 197 / 331 / 58
> totalIvars:  649 / 1063 / 257
> totalClassVars: 54 / 138 / 28
> totalInstMethods: 6651 / 9186 / 2115
> totalClassMethods: 303 / 858 / 127
>
> SimpleMorphic is much smaller. Core classes are simpler and easier to
> understand, fix and extend. The most important part is that this is not
> blind removal of unused code. A lot of the functionality has been redesigned
> to make it simpler, and the removal was done with great care to result in a
> consistent system. This work started in 2004, so we're talking of about 6
> years of careful work. All this means that SimpleMorphic does not support
> all the features that Pharo or Squeak might support. Please use the browsers
> and other tools in Cuis to check what it indeed can do.
>
> Talking about complexity, let's take for example, morph layout. This is
> started with #doLayoutIn: in Pharo and #doLayoutIfNeeded in SimpleMorphic.
>
> In Pharo, this method calls #adjustLayoutBounds: (19), #layout:in: (149),
> #layoutProportionallyIn: (10), #computeCellArrangement:in:horizontal:target:
> (87), #computeGlobalCellArrangement:in:horizontal:wrap:spacing: (31),
> #computeCellSizes:in:horizontal: (30),
> #computeExtraSpacing:in:horizontal:target: (136), #layoutLeftToRight:in:
> (91), #layoutTopToBottom:in: (91), #placeCells:in:horizontal:target: (70).
> The numbers in parenthesis are the sum of the lines of code of the
> implementors. Total lines of code for layout (taking only these most
> important methods) is 714. I doubt there are many people who really
> understand all of this code.
>
> In SimpleMorphic (Cuis), this calls #layoutSubmorphsIn: (10),
> #applyLayoutFrameIn: (11), #layout:in: (24). Total lines of code is 45. I
> believe any smalltalker could understand these in just minutes.
>

Indeed, a morphic layout logic always felt overly complicated to me.
It hard, because you don't know,
if you can remove/replace anything from there and still have a working
code. Good to see that you have managed to deal with that.

> I hope this makes makes it clearer to you what SimpleMorphic is.
>
> Cheers,
> Juan Vuletich
>
>



-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-project mailing list