Ben, Alexandre, tx, your explanations help and motivate. May I ask again
conc. question 2) and your example script:
RTMetricNormalizer new
elements: es;
normalizeSize: #numberOfMethods min: 20 max: 50;
normalizeColor: #numberOfVariables.
With “sideeffect” I meant in a way:
The above object is instantiated and messages are sent to it, but there is
no reference to instance kept (and later reused) like
aNormalizer := RTMetricNormalizer new elements: es; …
Where is the created instance „stored“? Is it linked to es (as kind of
“in/out parameter” of message elements)?
When does normalization actually take place?
RTGridLayout new on: es.
Similar question: There is no reference to instance kept like aGridLayout
:= RTGridLayout new on: es and later reused.
Is created instance linked to es (which is message parameter)?
@Ben:
Tx for explaining, that symbols and blocks both respond to #value and can
be used interchangeably.
Is there a section in Pharo by example explaining it? I have to look more
deeply.
P.S.: It seems intuitive/compelling how to use Roassal, but after reading
PharobyExample, there is an initial gap to understand the Roassal model
(how it works), at least for me.
BR Mike
Am 20.03.2017 2:39 nachm. schrieb "Alexandre Bergel" <
alexandre.bergel(a)me.com>gt;:
Dear Markus,
Agile Vis ebook is superb, copied following snippet, know hopefully what
it's doing, but want to make sure I understand how it works (in terms of
"plain" Pharo):
Thanks for your nice words.
1) @ RTPopup: Class name is enough, but it is initiated under the hood?
Yes. You can particularize the popup. For example, consider the script:
-=-=-=-=-=-=-=-=-=
v := RTView new.
es := (RTEllipse new color: Color blue) elementsOn: Collection
withAllSubclasses.
v addAll: es.
aPopup := RTPopup new
text: [ :aClass |
'Classname = ', aClass name, String cr,
'NbMethod=', aClass numberOfMethods asString, String cr,
'NbVariables=', aClass numberOfVariables asString ].
aPopup borderColor: Color black.
aPopup textColor: Color white.
aPopup backgroundColor: Color black.
es @ aPopup.
RTMetricNormalizer new
elements: es;
normalizeSize: #numberOfMethods min: 20 max: 50;
normalizeColor: #numberOfVariables.
RTGridLayout new on: es.
v
-=-=-=-=-=-=-=-=-=
2) RTMetricNormalizer new ...: There is no need to keep reference to
created object? Why? because messages sent to object (like normalizeSize)
have a "sideeffect" on es?
To RTMetricNormalizer, you can provide the Roassal elements or your
objects (#(4 5 1 2 3 5) in your example).
What do you mean by side effect? The class RTMetricNormalizer needs some
Roassal elements to operates. Either you provide them directly, as in the
example, or you can provide a view and the objects (in this case, roassal
elements are looked up).
The objects needs to answer to the messages indicated as argument to
normalizeSize: and normalizeColor:. In your example it is #yourself (all
pharo objects understand this, which returns the object itself). In the
example I have just given, it is #numberOfMethods and #numberOfVariables,
which are understood by Pharo classes (used as objects).
3) RTMetricNormalizer connects to model via #yourself? Is every symbol or
code block. that is sent to RTMetricNormalizer as argument, executed when
finally "sent" to es?
#yourself in your example indicates where to get the number used for the
size and color normalization. In that case, represented objects (numerical
values) are taken directly by the normalizer. But it could be different as
in my example. Classes are represented, and a metric is used to obtain a
numerical value.
Let us know if my answer make things clearer now. If no, then keep asking
please :-)
Cheers,
Alexandre
BR Mike
v := RTView new. es := (RTEllipse new color: Color blue) elementsOn: #(4 5
1 2 3 5). v addAll: es. es @ RTPopup. RTMetricNormalizer new elements:
es; alphaColor; normalizeSize: #yourself min: 20 max: 50; normalizeColor:
#yourself. RTHorizontalLineLayout new alignCenter; on: es. es @ RTLabeled.
v
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev