[squeak-dev] SimpleMorphic

Juan Vuletich juan at jvuletich.org
Wed Nov 10 17:46:54 UTC 2010

Hi Folks,

A few days ago I released SimpleMorphic for Pharo. SimpleMorphic is the 
Morphic implementation in Cuis. It is much smaller and simpler than the 
one in Pharo (and in Squeak). Please see 
. A link to the code (for Pharo 1.2) is included.

While this release of the code is for Pharo, it shouldn't be a big deal 
to make it run on Squeak. My hope is that the Pharo community studies it 
in detail, adopts it, and eventually remove the old Morphic. For Squeak, 
maybe the same happens. Or perhaps there would be 2 Morphic UIs for 
Squeak: FullMorphic+Etoys and SimpleMorphic... So, what do you think?

I also sent this comment to the Pharo mail list recently, trying to make 
clear why SimpleMorphic is useful:

"Size of 4 core classes (Morph, MorphExtension, PasteUpMorph and 
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."

Juan Vuletich

More information about the Squeak-dev mailing list