On Wed, Mar 22, 2017 at 1:12 AM, Alexandre Bergel alexandre.bergel@me.com wrote:
RTMetricNormalizer new
elements: es;
normalizeSize: #numberOfMethods min: 20 max: 50;
normalizeColor: #numberOfVariables.
I now fully understand your question :-) The terminology of object-orientation says that an “instance" is an “object” or a “class instance” (these three appellations are rigorously equivalent). The code above creates an instance of the class RTMetricNormalizer and initializes it. There are actually two normalizations, one occurring with the message #normalizeSize:min:max:, and the second one using #normalizeColor: As you can guess, the first normalization affects the size while the latter affects the color. The normalization happens in the method invoked by these messages, which are RTMetricNormalizer>>normalizeSize:min:max: and RTMetricNormalizer>> normalizeColor:.
The actual normalization happens in some private methods defined on RTMetricNormalizer. If you are curious, you can have a look at RTMetricNormalizer>>normalizeColor: metricBlock using: colors using: transformation min: min max: max
With “sideeffect” I meant in a way:
RTMetricNormalizer new elements: es; …
RTGridLayout new on: es.
Yes, you are absolutely right. The class RTMetricNormalizer, RTGridLayout operate by doing side effects on the relevant nodes. You can keep the instance if you wish so, but this is not necessary in this example.
Note that this way of coding is perfectly normal regarding object-oriented design. There is nothing particular to Roassal or Pharo here.
I guess the analogy is, that you make a hammer to bash the elements into shape, and then you throw the hammer away.
cheers -ben