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):
1) @ RTPopup: Class name is enough, but it is initiated under the hood? 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? 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? 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 _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
I can't answer for Roassal specific content, but in terms of plain
Pharo, for (3) you might be interested to try this example. In Playground, evaluate... Integer compile: ' plusOne ^ self + 1' . Then inspect... #(1 2 3) collect: #plusOne. Debug into it, to observe #value: sent to aBlock variable when it holds #plusOne such that ByteSymbol(Symbol)>>#value: twists this into a send of #plusOne (i.e. self) to anObject. In general, since symbols and blocks both respond to #value: they can be used interchangeably. cheers -ben On Sun, Mar 19, 2017 at 7:31 PM, Markus Böhm <[hidden email]> wrote: > > 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): > > 1) @ RTPopup: Class name is enough, but it is initiated under the hood? > 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? > 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? > > 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 > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.list.inf.unibe.ch/listinfo/moose-dev > Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Markus Böhm-2
Dear Markus,
Thanks for your nice words.
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 -=-=-=-=-=-=-=-=-=
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).
#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
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
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" <[hidden email]>:
_______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
On Tue, Mar 21, 2017 at 3:41 PM, Markus Böhm <[hidden email]> wrote:
From searching on " value: " in both Pharo By Example and Deep Into Pharo the doesn't seem to be. I logged an issue I could work on if there is positive feedback... cheers -ben _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Markus Böhm-2
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 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.
Agile Visualization mentions this aspect (as it is crucial in Roassal):
Yes, I understand your feeling. Roassal is a balance between easiness of writing code, and expressiveness of the framework. I believe that in any non-trivial framework / API there is a bit of complexity / magic that appears both fantastic and disturbing. Cheers, Alexandre
_______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
On Wed, Mar 22, 2017 at 1:12 AM, Alexandre Bergel
<[hidden email]> 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 _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
:-)
This is one way to see this yes :-)
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
Free forum by Nabble | Edit this page |