Quantcast

Design Challenge: metrics missing value...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Design Challenge: metrics missing value...

stepharong
Hi dear great OO designers

Here is a little challenges for your brainy souls :)

In Moose when we compute metrics it may happen than a tool (often external  
to pharo) does not compute a metrics
and when we request it in moose we check and often we return a not so good  
-1.

I'm trying to brainstorm on a solution

- first may be the simplest way is to not invoke a metrics when it is not  
computed. But it means that we should know it and that we should have a  
registration mechanism. After all this is probably the best solution.

- Second we were thinking to use exception but when we have multiple  
entities missing one metrics.... I have serious doubts.

- Second I was thinking about having the following behavior

testCollect

        | uarray collected |
        uarray := UniformOrderedCollection new.
        uarray add: 10.
        uarray add: 20.
        uarray add: (MissingValue discarding).
        collected := uarray collect: [ :each | each ].
        self assert: collected size equals: 2.

testDo

        | res uarray |
        uarray := UniformOrderedCollection new.
        uarray add: 10.
        uarray add: 20.
        uarray add: (MissingValue discarding).
        uarray add: 40.
        res := 0.
        uarray do: [ :each | res := res + each ].
        self assert: res equals: 70.


testCollectDefaulting

        | uarray collected |
        uarray := UniformOrderedCollection new.
        uarray add: 10.
        uarray add: 20.
        uarray add: (MissingValue default: 33).
        collected := uarray collect: [ :each | each ].
        self assert: collected size equals: 3.
        self assert: collected third equals: 33


I basically started to implement


do: aBlock
        "Refer to the comment in Collection|do:."
        1 to: self size do:
                [:index | (self at: index) toDo: aBlock on: self]



collect: aBlock
        "Evaluate aBlock with each of the receiver's elements as the argument.
        Collect the resulting values into a collection like the receiver. Answer
        the new collection."

        | newCollection |
        newCollection := self species new.
        self
                do: [ :each | each toCollect: aBlock on: newCollection ].
        ^ newCollection


and

DiscardingValue >> toCollect: aBlock on: aCollection
        "discard computation"
        ^ self


Object >> toCollect: aBlock on: aCollection

        ^ aCollection add: (aBlock value: self)


So I imagine that you see the design and I wanted to get your point of  
view.

--
Using Opera a kind of bad mail client but far better than thunderbird
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Design Challenge: metrics missing value...

SergeStinckwich
So basically you are trying to deal with missing values in collections.

People working with R or Python data analytics framework made some
ways to work with specific data structures called dataframes
where you can have some missing values.

For example you may have a look here:
http://pandas.pydata.org/pandas-docs/stable/missing_data.html


On Wed, Dec 21, 2016 at 4:15 AM, stepharong <[hidden email]> wrote:

> Hi dear great OO designers
>
> Here is a little challenges for your brainy souls :)
>
> In Moose when we compute metrics it may happen than a tool (often external
> to pharo) does not compute a metrics
> and when we request it in moose we check and often we return a not so good
> -1.
>
> I'm trying to brainstorm on a solution
>
> - first may be the simplest way is to not invoke a metrics when it is not
> computed. But it means that we should know it and that we should have a
> registration mechanism. After all this is probably the best solution.
>
> - Second we were thinking to use exception but when we have multiple
> entities missing one metrics.... I have serious doubts.
>
> - Second I was thinking about having the following behavior
>
> testCollect
>
>         | uarray collected |
>         uarray := UniformOrderedCollection new.
>         uarray add: 10.
>         uarray add: 20.
>         uarray add: (MissingValue discarding).
>         collected := uarray collect: [ :each | each ].
>         self assert: collected size equals: 2.
>
> testDo
>
>         | res uarray |
>         uarray := UniformOrderedCollection new.
>         uarray add: 10.
>         uarray add: 20.
>         uarray add: (MissingValue discarding).
>         uarray add: 40.
>         res := 0.
>         uarray do: [ :each | res := res + each ].
>         self assert: res equals: 70.
>
>
> testCollectDefaulting
>
>         | uarray collected |
>         uarray := UniformOrderedCollection new.
>         uarray add: 10.
>         uarray add: 20.
>         uarray add: (MissingValue default: 33).
>         collected := uarray collect: [ :each | each ].
>         self assert: collected size equals: 3.
>         self assert: collected third equals: 33
>
>
> I basically started to implement
>
>
> do: aBlock
>         "Refer to the comment in Collection|do:."
>         1 to: self size do:
>                 [:index | (self at: index) toDo: aBlock on: self]
>
>
>
> collect: aBlock
>         "Evaluate aBlock with each of the receiver's elements as the
> argument.
>         Collect the resulting values into a collection like the receiver.
> Answer
>         the new collection."
>
>         | newCollection |
>         newCollection := self species new.
>         self
>                 do: [ :each | each toCollect: aBlock on: newCollection ].
>         ^ newCollection
>
>
> and
>
> DiscardingValue >> toCollect: aBlock on: aCollection
>         "discard computation"
>         ^ self
>
>
> Object >> toCollect: aBlock on: aCollection
>
>         ^ aCollection add: (aBlock value: self)
>
>
> So I imagine that you see the design and I wanted to get your point of view.
>
> --
> Using Opera a kind of bad mail client but far better than thunderbird
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev



--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Design Challenge: metrics missing value...

Tudor Girba-2
In reply to this post by stepharong
Hi,

MissingValue (or NoValue) is definitely the way to go. The UniformOrderedCollection is an interesting idea, too. We had a NoValue like solution a long time ago but we discarded because we missed the idea around collections. It would be really cool to have this working.

Cheers,
Doru


> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>
> Hi dear great OO designers
>
> Here is a little challenges for your brainy souls :)
>
> In Moose when we compute metrics it may happen than a tool (often external to pharo) does not compute a metrics
> and when we request it in moose we check and often we return a not so good -1.
>
> I'm trying to brainstorm on a solution
>
> - first may be the simplest way is to not invoke a metrics when it is not computed. But it means that we should know it and that we should have a registration mechanism. After all this is probably the best solution.
>
> - Second we were thinking to use exception but when we have multiple entities missing one metrics.... I have serious doubts.
>
> - Second I was thinking about having the following behavior
>
> testCollect
>
> | uarray collected |
> uarray := UniformOrderedCollection new.
> uarray add: 10.
> uarray add: 20.
> uarray add: (MissingValue discarding).
> collected := uarray collect: [ :each | each ].
> self assert: collected size equals: 2.
>
> testDo
>
> | res uarray |
> uarray := UniformOrderedCollection new.
> uarray add: 10.
> uarray add: 20.
> uarray add: (MissingValue discarding).
> uarray add: 40.
> res := 0.
> uarray do: [ :each | res := res + each ].
> self assert: res equals: 70.
>
>
> testCollectDefaulting
>
> | uarray collected |
> uarray := UniformOrderedCollection new.
> uarray add: 10.
> uarray add: 20.
> uarray add: (MissingValue default: 33).
> collected := uarray collect: [ :each | each ].
> self assert: collected size equals: 3.
> self assert: collected third equals: 33
>
>
> I basically started to implement
>
>
> do: aBlock
> "Refer to the comment in Collection|do:."
> 1 to: self size do:
> [:index | (self at: index) toDo: aBlock on: self]
>
>
>
> collect: aBlock
> "Evaluate aBlock with each of the receiver's elements as the argument.
> Collect the resulting values into a collection like the receiver. Answer
> the new collection."
>
> | newCollection |
> newCollection := self species new.
> self
> do: [ :each | each toCollect: aBlock on: newCollection ].
> ^ newCollection
>
>
> and
>
> DiscardingValue >> toCollect: aBlock on: aCollection
> "discard computation"
> ^ self
>
>
> Object >> toCollect: aBlock on: aCollection
>
> ^ aCollection add: (aBlock value: self)
>
>
> So I imagine that you see the design and I wanted to get your point of view.
>
> --
> Using Opera a kind of bad mail client but far better than thunderbird
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev

--
www.tudorgirba.com
www.feenk.com

"One cannot do more than one can do."




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Design Challenge: metrics missing value...

abergel
In reply to this post by stepharong
Hi Stef,

You are raising an interesting point to discuss. This MissingValue is indeed better than having -1
Something to keep in mind: it may be that one would like to focus on the missing value and not really the value.

Consider:

> testCollect
>
> | uarray collected |
> uarray := UniformOrderedCollection new.
> uarray add: 10.
> uarray add: 20.
> uarray add: (MissingValue discarding).
> collected := uarray collect: [ :each | each ].
> self assert: collected size equals: 2.

It could well be that I would like to be able to query over the MissingValue.
Can something like possible: uarray collect: #isMissing
?

Cheers,
Alexandre


> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>
> Hi dear great OO designers
>
> Here is a little challenges for your brainy souls :)
>
> In Moose when we compute metrics it may happen than a tool (often external to pharo) does not compute a metrics
> and when we request it in moose we check and often we return a not so good -1.
>
> I'm trying to brainstorm on a solution
>
> - first may be the simplest way is to not invoke a metrics when it is not computed. But it means that we should know it and that we should have a registration mechanism. After all this is probably the best solution.
>
> - Second we were thinking to use exception but when we have multiple entities missing one metrics.... I have serious doubts.
>
> - Second I was thinking about having the following behavior
>
> testCollect
>
> | uarray collected |
> uarray := UniformOrderedCollection new.
> uarray add: 10.
> uarray add: 20.
> uarray add: (MissingValue discarding).
> collected := uarray collect: [ :each | each ].
> self assert: collected size equals: 2.
>
> testDo
>
> | res uarray |
> uarray := UniformOrderedCollection new.
> uarray add: 10.
> uarray add: 20.
> uarray add: (MissingValue discarding).
> uarray add: 40.
> res := 0.
> uarray do: [ :each | res := res + each ].
> self assert: res equals: 70.
>
>
> testCollectDefaulting
>
> | uarray collected |
> uarray := UniformOrderedCollection new.
> uarray add: 10.
> uarray add: 20.
> uarray add: (MissingValue default: 33).
> collected := uarray collect: [ :each | each ].
> self assert: collected size equals: 3.
> self assert: collected third equals: 33
>
>
> I basically started to implement
>
>
> do: aBlock
> "Refer to the comment in Collection|do:."
> 1 to: self size do:
> [:index | (self at: index) toDo: aBlock on: self]
>
>
>
> collect: aBlock
> "Evaluate aBlock with each of the receiver's elements as the argument.
> Collect the resulting values into a collection like the receiver. Answer
> the new collection."
>
> | newCollection |
> newCollection := self species new.
> self
> do: [ :each | each toCollect: aBlock on: newCollection ].
> ^ newCollection
>
>
> and
>
> DiscardingValue >> toCollect: aBlock on: aCollection
> "discard computation"
> ^ self
>
>
> Object >> toCollect: aBlock on: aCollection
>
> ^ aCollection add: (aBlock value: self)
>
>
> So I imagine that you see the design and I wanted to get your point of view.
>
> --
> Using Opera a kind of bad mail client but far better than thunderbird
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Design Challenge: metrics missing value...

Tudor Girba-2
Hi Alex,

Following the design proposed by Stef, in your case you would use a different collection.

Cheers,
Doru


> On Dec 21, 2016, at 8:13 AM, Alexandre Bergel <[hidden email]> wrote:
>
> Hi Stef,
>
> You are raising an interesting point to discuss. This MissingValue is indeed better than having -1
> Something to keep in mind: it may be that one would like to focus on the missing value and not really the value.
>
> Consider:
>
>> testCollect
>>
>> | uarray collected |
>> uarray := UniformOrderedCollection new.
>> uarray add: 10.
>> uarray add: 20.
>> uarray add: (MissingValue discarding).
>> collected := uarray collect: [ :each | each ].
>> self assert: collected size equals: 2.
>
> It could well be that I would like to be able to query over the MissingValue.
> Can something like possible: uarray collect: #isMissing
> ?
>
> Cheers,
> Alexandre
>
>
>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>
>> Hi dear great OO designers
>>
>> Here is a little challenges for your brainy souls :)
>>
>> In Moose when we compute metrics it may happen than a tool (often external to pharo) does not compute a metrics
>> and when we request it in moose we check and often we return a not so good -1.
>>
>> I'm trying to brainstorm on a solution
>>
>> - first may be the simplest way is to not invoke a metrics when it is not computed. But it means that we should know it and that we should have a registration mechanism. After all this is probably the best solution.
>>
>> - Second we were thinking to use exception but when we have multiple entities missing one metrics.... I have serious doubts.
>>
>> - Second I was thinking about having the following behavior
>>
>> testCollect
>>
>> | uarray collected |
>> uarray := UniformOrderedCollection new.
>> uarray add: 10.
>> uarray add: 20.
>> uarray add: (MissingValue discarding).
>> collected := uarray collect: [ :each | each ].
>> self assert: collected size equals: 2.
>>
>> testDo
>>
>> | res uarray |
>> uarray := UniformOrderedCollection new.
>> uarray add: 10.
>> uarray add: 20.
>> uarray add: (MissingValue discarding).
>> uarray add: 40.
>> res := 0.
>> uarray do: [ :each | res := res + each ].
>> self assert: res equals: 70.
>>
>>
>> testCollectDefaulting
>>
>> | uarray collected |
>> uarray := UniformOrderedCollection new.
>> uarray add: 10.
>> uarray add: 20.
>> uarray add: (MissingValue default: 33).
>> collected := uarray collect: [ :each | each ].
>> self assert: collected size equals: 3.
>> self assert: collected third equals: 33
>>
>>
>> I basically started to implement
>>
>>
>> do: aBlock
>> "Refer to the comment in Collection|do:."
>> 1 to: self size do:
>> [:index | (self at: index) toDo: aBlock on: self]
>>
>>
>>
>> collect: aBlock
>> "Evaluate aBlock with each of the receiver's elements as the argument.
>> Collect the resulting values into a collection like the receiver. Answer
>> the new collection."
>>
>> | newCollection |
>> newCollection := self species new.
>> self
>> do: [ :each | each toCollect: aBlock on: newCollection ].
>> ^ newCollection
>>
>>
>> and
>>
>> DiscardingValue >> toCollect: aBlock on: aCollection
>> "discard computation"
>> ^ self
>>
>>
>> Object >> toCollect: aBlock on: aCollection
>>
>> ^ aCollection add: (aBlock value: self)
>>
>>
>> So I imagine that you see the design and I wanted to get your point of view.
>>
>> --
>> Using Opera a kind of bad mail client but far better than thunderbird
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev

--
www.tudorgirba.com
www.feenk.com

"If you interrupt the barber while he is cutting your hair,
you will end up with a messy haircut."

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Design Challenge: metrics missing value...

Tudor Girba-2
Hi,

I forgot to mention that another option I played with was to always use a metric object, and never numbers. So, numberOfLinesOfCode would return a MetricValue. I think the same idea is present in acqoncagua.

Cheers,
Doru

--
www.tudorgirba.com

"Every thing has its own flow"

> On 21 Dec 2016, at 08:21, Tudor Girba <[hidden email]> wrote:
>
> Hi Alex,
>
> Following the design proposed by Stef, in your case you would use a different collection.
>
> Cheers,
> Doru
>
>
>> On Dec 21, 2016, at 8:13 AM, Alexandre Bergel <[hidden email]> wrote:
>>
>> Hi Stef,
>>
>> You are raising an interesting point to discuss. This MissingValue is indeed better than having -1
>> Something to keep in mind: it may be that one would like to focus on the missing value and not really the value.
>>
>> Consider:
>>
>>> testCollect
>>>
>>>    | uarray collected |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue discarding).
>>>    collected := uarray collect: [ :each | each ].    
>>>    self assert: collected size equals: 2.
>>
>> It could well be that I would like to be able to query over the MissingValue.
>> Can something like possible: uarray collect: #isMissing
>> ?
>>
>> Cheers,
>> Alexandre
>>
>>
>>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>>
>>> Hi dear great OO designers
>>>
>>> Here is a little challenges for your brainy souls :)
>>>
>>> In Moose when we compute metrics it may happen than a tool (often external to pharo) does not compute a metrics
>>> and when we request it in moose we check and often we return a not so good -1.
>>>
>>> I'm trying to brainstorm on a solution
>>>
>>> - first may be the simplest way is to not invoke a metrics when it is not computed. But it means that we should know it and that we should have a registration mechanism. After all this is probably the best solution.
>>>
>>> - Second we were thinking to use exception but when we have multiple entities missing one metrics.... I have serious doubts.
>>>
>>> - Second I was thinking about having the following behavior
>>>
>>> testCollect
>>>
>>>    | uarray collected |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue discarding).
>>>    collected := uarray collect: [ :each | each ].    
>>>    self assert: collected size equals: 2.
>>>
>>> testDo
>>>
>>>    | res uarray |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue discarding).
>>>    uarray add: 40.
>>>    res := 0.
>>>    uarray do: [ :each | res := res + each ].    
>>>    self assert: res equals: 70.
>>>
>>>
>>> testCollectDefaulting
>>>
>>>    | uarray collected |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue default: 33).
>>>    collected := uarray collect: [ :each | each ].    
>>>    self assert: collected size equals: 3.
>>>    self assert: collected third equals: 33
>>>
>>>
>>> I basically started to implement
>>>
>>>
>>> do: aBlock
>>>    "Refer to the comment in Collection|do:."
>>>    1 to: self size do:
>>>        [:index | (self at: index) toDo: aBlock on: self]
>>>
>>>
>>>
>>> collect: aBlock
>>>    "Evaluate aBlock with each of the receiver's elements as the argument.
>>>    Collect the resulting values into a collection like the receiver. Answer
>>>    the new collection."
>>>
>>>    | newCollection |
>>>    newCollection := self species new.
>>>    self
>>>        do: [ :each | each toCollect: aBlock on: newCollection ].
>>>    ^ newCollection
>>>
>>>
>>> and
>>>
>>> DiscardingValue >> toCollect: aBlock on: aCollection
>>>    "discard computation"
>>>    ^ self
>>>
>>>
>>> Object >> toCollect: aBlock on: aCollection
>>>
>>>    ^ aCollection add: (aBlock value: self)
>>>
>>>
>>> So I imagine that you see the design and I wanted to get your point of view.
>>>
>>> --
>>> Using Opera a kind of bad mail client but far better than thunderbird
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>
> --
> www.tudorgirba.com
> www.feenk.com
>
> "If you interrupt the barber while he is cutting your hair,
> you will end up with a messy haircut."
>
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Design Challenge: metrics missing value...

Damien Pollet
On a more general note, what do you think of how it's done in other languages (Haskell's "Maybe") ?

We already have it in the form of nil / all other objects and #ifNil:, but that would make it explicit with a couple of classes: 

Maybe subclass: ActualValue
Maybe subclass: MissingValue
and a #default: or #orElse: accessor to get the wrapped value, defaulting to something else, or some block-evaluating message similar to #ifNotNilDo:

On 21 December 2016 at 12:05, Tudor Girba <[hidden email]> wrote:
Hi,

I forgot to mention that another option I played with was to always use a metric object, and never numbers. So, numberOfLinesOfCode would return a MetricValue. I think the same idea is present in acqoncagua.

Cheers,
Doru

--
www.tudorgirba.com

"Every thing has its own flow"

> On 21 Dec 2016, at 08:21, Tudor Girba <[hidden email]> wrote:
>
> Hi Alex,
>
> Following the design proposed by Stef, in your case you would use a different collection.
>
> Cheers,
> Doru
>
>
>> On Dec 21, 2016, at 8:13 AM, Alexandre Bergel <[hidden email]> wrote:
>>
>> Hi Stef,
>>
>> You are raising an interesting point to discuss. This MissingValue is indeed better than having -1
>> Something to keep in mind: it may be that one would like to focus on the missing value and not really the value.
>>
>> Consider:
>>
>>> testCollect
>>>
>>>    | uarray collected |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue discarding).
>>>    collected := uarray collect: [ :each | each ].
>>>    self assert: collected size equals: 2.
>>
>> It could well be that I would like to be able to query over the MissingValue.
>> Can something like possible: uarray collect: #isMissing
>> ?
>>
>> Cheers,
>> Alexandre
>>
>>
>>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>>
>>> Hi dear great OO designers
>>>
>>> Here is a little challenges for your brainy souls :)
>>>
>>> In Moose when we compute metrics it may happen than a tool (often external to pharo) does not compute a metrics
>>> and when we request it in moose we check and often we return a not so good -1.
>>>
>>> I'm trying to brainstorm on a solution
>>>
>>> - first may be the simplest way is to not invoke a metrics when it is not computed. But it means that we should know it and that we should have a registration mechanism. After all this is probably the best solution.
>>>
>>> - Second we were thinking to use exception but when we have multiple entities missing one metrics.... I have serious doubts.
>>>
>>> - Second I was thinking about having the following behavior
>>>
>>> testCollect
>>>
>>>    | uarray collected |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue discarding).
>>>    collected := uarray collect: [ :each | each ].
>>>    self assert: collected size equals: 2.
>>>
>>> testDo
>>>
>>>    | res uarray |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue discarding).
>>>    uarray add: 40.
>>>    res := 0.
>>>    uarray do: [ :each | res := res + each ].
>>>    self assert: res equals: 70.
>>>
>>>
>>> testCollectDefaulting
>>>
>>>    | uarray collected |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue default: 33).
>>>    collected := uarray collect: [ :each | each ].
>>>    self assert: collected size equals: 3.
>>>    self assert: collected third equals: 33
>>>
>>>
>>> I basically started to implement
>>>
>>>
>>> do: aBlock
>>>    "Refer to the comment in Collection|do:."
>>>    1 to: self size do:
>>>        [:index | (self at: index) toDo: aBlock on: self]
>>>
>>>
>>>
>>> collect: aBlock
>>>    "Evaluate aBlock with each of the receiver's elements as the argument.
>>>    Collect the resulting values into a collection like the receiver. Answer
>>>    the new collection."
>>>
>>>    | newCollection |
>>>    newCollection := self species new.
>>>    self
>>>        do: [ :each | each toCollect: aBlock on: newCollection ].
>>>    ^ newCollection
>>>
>>>
>>> and
>>>
>>> DiscardingValue >> toCollect: aBlock on: aCollection
>>>    "discard computation"
>>>    ^ self
>>>
>>>
>>> Object >> toCollect: aBlock on: aCollection
>>>
>>>    ^ aCollection add: (aBlock value: self)
>>>
>>>
>>> So I imagine that you see the design and I wanted to get your point of view.
>>>
>>> --
>>> Using Opera a kind of bad mail client but far better than thunderbird
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>
> --
> www.tudorgirba.com
> www.feenk.com
>
> "If you interrupt the barber while he is cutting your hair,
> you will end up with a messy haircut."
>
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev



--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Design Challenge: metrics missing value...

stepharong
In reply to this post by Tudor Girba-2
On Wed, 21 Dec 2016 08:07:39 +0100, Tudor Girba <[hidden email]>  
wrote:

> Hi,
>
> MissingValue (or NoValue) is definitely the way to go. The  
> UniformOrderedCollection is an interesting idea, too. We had a NoValue  
> like solution a long time ago but we discarded because we missed the  
> idea around collections. It would be really cool to have this working.

I can continue to see the amount of protocol that should be implemented.

Now I'm thinking that for moose I would like MetricComputer (an object  
computing a metric)
and that tools list explicitly the metrics they need.
The goal is to make metrics first class entity (but not at the model level  
rto avoid to have object just wrapping a number).

stef



>
> Cheers,
> Doru
>
>
>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>
>> Hi dear great OO designers
>>
>> Here is a little challenges for your brainy souls :)
>>
>> In Moose when we compute metrics it may happen than a tool (often  
>> external to pharo) does not compute a metrics
>> and when we request it in moose we check and often we return a not so  
>> good -1.
>>
>> I'm trying to brainstorm on a solution
>>
>> - first may be the simplest way is to not invoke a metrics when it is  
>> not computed. But it means that we should know it and that we should  
>> have a registration mechanism. After all this is probably the best  
>> solution.
>>
>> - Second we were thinking to use exception but when we have multiple  
>> entities missing one metrics.... I have serious doubts.
>>
>> - Second I was thinking about having the following behavior
>>
>> testCollect
>>
>> | uarray collected |
>> uarray := UniformOrderedCollection new.
>> uarray add: 10.
>> uarray add: 20.
>> uarray add: (MissingValue discarding).
>> collected := uarray collect: [ :each | each ].
>> self assert: collected size equals: 2.
>>
>> testDo
>>
>> | res uarray |
>> uarray := UniformOrderedCollection new.
>> uarray add: 10.
>> uarray add: 20.
>> uarray add: (MissingValue discarding).
>> uarray add: 40.
>> res := 0.
>> uarray do: [ :each | res := res + each ].
>> self assert: res equals: 70.
>>
>>
>> testCollectDefaulting
>>
>> | uarray collected |
>> uarray := UniformOrderedCollection new.
>> uarray add: 10.
>> uarray add: 20.
>> uarray add: (MissingValue default: 33).
>> collected := uarray collect: [ :each | each ].
>> self assert: collected size equals: 3.
>> self assert: collected third equals: 33
>>
>>
>> I basically started to implement
>>
>>
>> do: aBlock
>> "Refer to the comment in Collection|do:."
>> 1 to: self size do:
>> [:index | (self at: index) toDo: aBlock on: self]
>>
>>
>>
>> collect: aBlock
>> "Evaluate aBlock with each of the receiver's elements as the argument.
>> Collect the resulting values into a collection like the receiver.  
>> Answer
>> the new collection."
>>
>> | newCollection |
>> newCollection := self species new.
>> self
>> do: [ :each | each toCollect: aBlock on: newCollection ].
>> ^ newCollection
>>
>>
>> and
>>
>> DiscardingValue >> toCollect: aBlock on: aCollection
>> "discard computation"
>> ^ self
>>
>>
>> Object >> toCollect: aBlock on: aCollection
>>
>> ^ aCollection add: (aBlock value: self)
>>
>>
>> So I imagine that you see the design and I wanted to get your point of  
>> view.
>>
>> --
>> Using Opera a kind of bad mail client but far better than thunderbird
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>
> --
> www.tudorgirba.com
> www.feenk.com
>
> "One cannot do more than one can do."
>
>
>
>
>


--
Using Opera's mail client: http://www.opera.com/mail/
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Design Challenge: metrics missing value...

stepharong
In reply to this post by abergel
On Wed, 21 Dec 2016 08:13:19 +0100, Alexandre Bergel  
<[hidden email]> wrote:

> Hi Stef,
>
> You are raising an interesting point to discuss. This MissingValue is  
> indeed better than having -1
> Something to keep in mind: it may be that one would like to focus on the  
> missing value and not really the value.

can you give an example?



>
> Consider:
>
>> testCollect
>>
>> | uarray collected |
>> uarray := UniformOrderedCollection new.
>> uarray add: 10.
>> uarray add: 20.
>> uarray add: (MissingValue discarding).
>> collected := uarray collect: [ :each | each ].
>> self assert: collected size equals: 2.
>
> It could well be that I would like to be able to query over the  
> MissingValue.
> Can something like possible: uarray collect: #isMissing

I see what you mean. I will see what I can do.




>
> Cheers,
> Alexandre
>
>
>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>
>> Hi dear great OO designers
>>
>> Here is a little challenges for your brainy souls :)
>>
>> In Moose when we compute metrics it may happen than a tool (often  
>> external to pharo) does not compute a metrics
>> and when we request it in moose we check and often we return a not so  
>> good -1.
>>
>> I'm trying to brainstorm on a solution
>>
>> - first may be the simplest way is to not invoke a metrics when it is  
>> not computed. But it means that we should know it and that we should  
>> have a registration mechanism. After all this is probably the best  
>> solution.
>>
>> - Second we were thinking to use exception but when we have multiple  
>> entities missing one metrics.... I have serious doubts.
>>
>> - Second I was thinking about having the following behavior
>>
>> testCollect
>>
>> | uarray collected |
>> uarray := UniformOrderedCollection new.
>> uarray add: 10.
>> uarray add: 20.
>> uarray add: (MissingValue discarding).
>> collected := uarray collect: [ :each | each ].
>> self assert: collected size equals: 2.
>>
>> testDo
>>
>> | res uarray |
>> uarray := UniformOrderedCollection new.
>> uarray add: 10.
>> uarray add: 20.
>> uarray add: (MissingValue discarding).
>> uarray add: 40.
>> res := 0.
>> uarray do: [ :each | res := res + each ].
>> self assert: res equals: 70.
>>
>>
>> testCollectDefaulting
>>
>> | uarray collected |
>> uarray := UniformOrderedCollection new.
>> uarray add: 10.
>> uarray add: 20.
>> uarray add: (MissingValue default: 33).
>> collected := uarray collect: [ :each | each ].
>> self assert: collected size equals: 3.
>> self assert: collected third equals: 33
>>
>>
>> I basically started to implement
>>
>>
>> do: aBlock
>> "Refer to the comment in Collection|do:."
>> 1 to: self size do:
>> [:index | (self at: index) toDo: aBlock on: self]
>>
>>
>>
>> collect: aBlock
>> "Evaluate aBlock with each of the receiver's elements as the argument.
>> Collect the resulting values into a collection like the receiver.  
>> Answer
>> the new collection."
>>
>> | newCollection |
>> newCollection := self species new.
>> self
>> do: [ :each | each toCollect: aBlock on: newCollection ].
>> ^ newCollection
>>
>>
>> and
>>
>> DiscardingValue >> toCollect: aBlock on: aCollection
>> "discard computation"
>> ^ self
>>
>>
>> Object >> toCollect: aBlock on: aCollection
>>
>> ^ aCollection add: (aBlock value: self)
>>
>>
>> So I imagine that you see the design and I wanted to get your point of  
>> view.
>>
>> --
>> Using Opera a kind of bad mail client but far better than thunderbird
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>


--
Using Opera's mail client: http://www.opera.com/mail/
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Design Challenge: metrics missing value...

stepharong
In reply to this post by Tudor Girba-2


> Hi Alex,
>
> Following the design proposed by Stef, in your case you would use a  
> different collection.

Doru I have multiple missingValue so that they embed their own strategy.
Now I do not know for the scenario of alex.

>
> Cheers,
> Doru
>
>
>> On Dec 21, 2016, at 8:13 AM, Alexandre Bergel <[hidden email]>  
>> wrote:
>>
>> Hi Stef,
>>
>> You are raising an interesting point to discuss. This MissingValue is  
>> indeed better than having -1
>> Something to keep in mind: it may be that one would like to focus on  
>> the missing value and not really the value.
>>
>> Consider:
>>
>>> testCollect
>>>
>>> | uarray collected |
>>> uarray := UniformOrderedCollection new.
>>> uarray add: 10.
>>> uarray add: 20.
>>> uarray add: (MissingValue discarding).
>>> collected := uarray collect: [ :each | each ].
>>> self assert: collected size equals: 2.
>>
>> It could well be that I would like to be able to query over the  
>> MissingValue.
>> Can something like possible: uarray collect: #isMissing
>> ?
>>
>> Cheers,
>> Alexandre
>>
>>
>>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>>
>>> Hi dear great OO designers
>>>
>>> Here is a little challenges for your brainy souls :)
>>>
>>> In Moose when we compute metrics it may happen than a tool (often  
>>> external to pharo) does not compute a metrics
>>> and when we request it in moose we check and often we return a not so  
>>> good -1.
>>>
>>> I'm trying to brainstorm on a solution
>>>
>>> - first may be the simplest way is to not invoke a metrics when it is  
>>> not computed. But it means that we should know it and that we should  
>>> have a registration mechanism. After all this is probably the best  
>>> solution.
>>>
>>> - Second we were thinking to use exception but when we have multiple  
>>> entities missing one metrics.... I have serious doubts.
>>>
>>> - Second I was thinking about having the following behavior
>>>
>>> testCollect
>>>
>>> | uarray collected |
>>> uarray := UniformOrderedCollection new.
>>> uarray add: 10.
>>> uarray add: 20.
>>> uarray add: (MissingValue discarding).
>>> collected := uarray collect: [ :each | each ].
>>> self assert: collected size equals: 2.
>>>
>>> testDo
>>>
>>> | res uarray |
>>> uarray := UniformOrderedCollection new.
>>> uarray add: 10.
>>> uarray add: 20.
>>> uarray add: (MissingValue discarding).
>>> uarray add: 40.
>>> res := 0.
>>> uarray do: [ :each | res := res + each ].
>>> self assert: res equals: 70.
>>>
>>>
>>> testCollectDefaulting
>>>
>>> | uarray collected |
>>> uarray := UniformOrderedCollection new.
>>> uarray add: 10.
>>> uarray add: 20.
>>> uarray add: (MissingValue default: 33).
>>> collected := uarray collect: [ :each | each ].
>>> self assert: collected size equals: 3.
>>> self assert: collected third equals: 33
>>>
>>>
>>> I basically started to implement
>>>
>>>
>>> do: aBlock
>>> "Refer to the comment in Collection|do:."
>>> 1 to: self size do:
>>> [:index | (self at: index) toDo: aBlock on: self]
>>>
>>>
>>>
>>> collect: aBlock
>>> "Evaluate aBlock with each of the receiver's elements as the argument.
>>> Collect the resulting values into a collection like the receiver.  
>>> Answer
>>> the new collection."
>>>
>>> | newCollection |
>>> newCollection := self species new.
>>> self
>>> do: [ :each | each toCollect: aBlock on: newCollection ].
>>> ^ newCollection
>>>
>>>
>>> and
>>>
>>> DiscardingValue >> toCollect: aBlock on: aCollection
>>> "discard computation"
>>> ^ self
>>>
>>>
>>> Object >> toCollect: aBlock on: aCollection
>>>
>>> ^ aCollection add: (aBlock value: self)
>>>
>>>
>>> So I imagine that you see the design and I wanted to get your point of  
>>> view.
>>>
>>> --
>>> Using Opera a kind of bad mail client but far better than thunderbird
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>
> --
> www.tudorgirba.com
> www.feenk.com
>
> "If you interrupt the barber while he is cutting your hair,
> you will end up with a messy haircut."
>
>


--
Using Opera's mail client: http://www.opera.com/mail/
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Design Challenge: metrics missing value...

stepharong
In reply to this post by Tudor Girba-2
On Wed, 21 Dec 2016 12:05:32 +0100, Tudor Girba <[hidden email]>  
wrote:

> Hi,
>
> I forgot to mention that another option I played with was to always use  
> a metric object, and never numbers. So, numberOfLinesOfCode would return  
> a MetricValue. I think the same idea is present in acqoncagua.

Yes in fact may be we should hold the value as raw data and create on  
demande the metricValue.
to avoid to have millions on them.
Or a kind of flightweight


>
> Cheers,
> Doru
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"
>
>> On 21 Dec 2016, at 08:21, Tudor Girba <[hidden email]> wrote:
>>
>> Hi Alex,
>>
>> Following the design proposed by Stef, in your case you would use a  
>> different collection.
>>
>> Cheers,
>> Doru
>>
>>
>>> On Dec 21, 2016, at 8:13 AM, Alexandre Bergel  
>>> <[hidden email]> wrote:
>>>
>>> Hi Stef,
>>>
>>> You are raising an interesting point to discuss. This MissingValue is  
>>> indeed better than having -1
>>> Something to keep in mind: it may be that one would like to focus on  
>>> the missing value and not really the value.
>>>
>>> Consider:
>>>
>>>> testCollect
>>>>
>>>>    | uarray collected |
>>>>    uarray := UniformOrderedCollection new.
>>>>    uarray add: 10.
>>>>    uarray add: 20.
>>>>    uarray add: (MissingValue discarding).
>>>>    collected := uarray collect: [ :each | each ].
>>>>    self assert: collected size equals: 2.
>>>
>>> It could well be that I would like to be able to query over the  
>>> MissingValue.
>>> Can something like possible: uarray collect: #isMissing
>>> ?
>>>
>>> Cheers,
>>> Alexandre
>>>
>>>
>>>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>>>
>>>> Hi dear great OO designers
>>>>
>>>> Here is a little challenges for your brainy souls :)
>>>>
>>>> In Moose when we compute metrics it may happen than a tool (often  
>>>> external to pharo) does not compute a metrics
>>>> and when we request it in moose we check and often we return a not so  
>>>> good -1.
>>>>
>>>> I'm trying to brainstorm on a solution
>>>>
>>>> - first may be the simplest way is to not invoke a metrics when it is  
>>>> not computed. But it means that we should know it and that we should  
>>>> have a registration mechanism. After all this is probably the best  
>>>> solution.
>>>>
>>>> - Second we were thinking to use exception but when we have multiple  
>>>> entities missing one metrics.... I have serious doubts.
>>>>
>>>> - Second I was thinking about having the following behavior
>>>>
>>>> testCollect
>>>>
>>>>    | uarray collected |
>>>>    uarray := UniformOrderedCollection new.
>>>>    uarray add: 10.
>>>>    uarray add: 20.
>>>>    uarray add: (MissingValue discarding).
>>>>    collected := uarray collect: [ :each | each ].
>>>>    self assert: collected size equals: 2.
>>>>
>>>> testDo
>>>>
>>>>    | res uarray |
>>>>    uarray := UniformOrderedCollection new.
>>>>    uarray add: 10.
>>>>    uarray add: 20.
>>>>    uarray add: (MissingValue discarding).
>>>>    uarray add: 40.
>>>>    res := 0.
>>>>    uarray do: [ :each | res := res + each ].
>>>>    self assert: res equals: 70.
>>>>
>>>>
>>>> testCollectDefaulting
>>>>
>>>>    | uarray collected |
>>>>    uarray := UniformOrderedCollection new.
>>>>    uarray add: 10.
>>>>    uarray add: 20.
>>>>    uarray add: (MissingValue default: 33).
>>>>    collected := uarray collect: [ :each | each ].
>>>>    self assert: collected size equals: 3.
>>>>    self assert: collected third equals: 33
>>>>
>>>>
>>>> I basically started to implement
>>>>
>>>>
>>>> do: aBlock
>>>>    "Refer to the comment in Collection|do:."
>>>>    1 to: self size do:
>>>>        [:index | (self at: index) toDo: aBlock on: self]
>>>>
>>>>
>>>>
>>>> collect: aBlock
>>>>    "Evaluate aBlock with each of the receiver's elements as the  
>>>> argument.
>>>>    Collect the resulting values into a collection like the receiver.  
>>>> Answer
>>>>    the new collection."
>>>>
>>>>    | newCollection |
>>>>    newCollection := self species new.
>>>>    self
>>>>        do: [ :each | each toCollect: aBlock on: newCollection ].
>>>>    ^ newCollection
>>>>
>>>>
>>>> and
>>>>
>>>> DiscardingValue >> toCollect: aBlock on: aCollection
>>>>    "discard computation"
>>>>    ^ self
>>>>
>>>>
>>>> Object >> toCollect: aBlock on: aCollection
>>>>
>>>>    ^ aCollection add: (aBlock value: self)
>>>>
>>>>
>>>> So I imagine that you see the design and I wanted to get your point  
>>>> of view.
>>>>
>>>> --
>>>> Using Opera a kind of bad mail client but far better than thunderbird
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> [hidden email]
>>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>>
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>
>> --
>> www.tudorgirba.com
>> www.feenk.com
>>
>> "If you interrupt the barber while he is cutting your hair,
>> you will end up with a messy haircut."
>>
>


--
Using Opera's mail client: http://www.opera.com/mail/
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Re: Design Challenge: metrics missing value...

stepharong
In reply to this post by Damien Pollet
Hi damien

why not :)
Now I do not know if may be is helping me in my scenario.



On Wed, 21 Dec 2016 13:54:12 +0100, Damien Pollet <[hidden email]> wrote:

On a more general note, what do you think of how it's done in other languages (Haskell's "Maybe") ?

We already have it in the form of nil / all other objects and #ifNil:, but that would make it explicit with a couple of classes: 

Maybe subclass: ActualValue
Maybe subclass: MissingValue
and a #default: or #orElse: accessor to get the wrapped value, defaulting to something else, or some block-evaluating message similar to #ifNotNilDo:

On 21 December 2016 at 12:05, Tudor Girba <[hidden email]> wrote:
Hi,

I forgot to mention that another option I played with was to always use a metric object, and never numbers. So, numberOfLinesOfCode would return a MetricValue. I think the same idea is present in acqoncagua.

Cheers,
Doru

--
www.tudorgirba.com

"Every thing has its own flow"

> On 21 Dec 2016, at 08:21, Tudor Girba <[hidden email]> wrote:
>
> Hi Alex,
>
> Following the design proposed by Stef, in your case you would use a different collection.
>
> Cheers,
> Doru
>
>
>> On Dec 21, 2016, at 8:13 AM, Alexandre Bergel <[hidden email]> wrote:
>>
>> Hi Stef,
>>
>> You are raising an interesting point to discuss. This MissingValue is indeed better than having -1
>> Something to keep in mind: it may be that one would like to focus on the missing value and not really the value.
>>
>> Consider:
>>
>>> testCollect
>>>
>>>    | uarray collected |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue discarding).
>>>    collected := uarray collect: [ :each | each ].
>>>    self assert: collected size equals: 2.
>>
>> It could well be that I would like to be able to query over the MissingValue.
>> Can something like possible: uarray collect: #isMissing
>> ?
>>
>> Cheers,
>> Alexandre
>>
>>
>>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>>
>>> Hi dear great OO designers
>>>
>>> Here is a little challenges for your brainy souls :)
>>>
>>> In Moose when we compute metrics it may happen than a tool (often external to pharo) does not compute a metrics
>>> and when we request it in moose we check and often we return a not so good -1.
>>>
>>> I'm trying to brainstorm on a solution
>>>
>>> - first may be the simplest way is to not invoke a metrics when it is not computed. But it means that we should know it and that we should have a registration mechanism. After all this is probably the best solution.
>>>
>>> - Second we were thinking to use exception but when we have multiple entities missing one metrics.... I have serious doubts.
>>>
>>> - Second I was thinking about having the following behavior
>>>
>>> testCollect
>>>
>>>    | uarray collected |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue discarding).
>>>    collected := uarray collect: [ :each | each ].
>>>    self assert: collected size equals: 2.
>>>
>>> testDo
>>>
>>>    | res uarray |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue discarding).
>>>    uarray add: 40.
>>>    res := 0.
>>>    uarray do: [ :each | res := res + each ].
>>>    self assert: res equals: 70.
>>>
>>>
>>> testCollectDefaulting
>>>
>>>    | uarray collected |
>>>    uarray := UniformOrderedCollection new.
>>>    uarray add: 10.
>>>    uarray add: 20.
>>>    uarray add: (MissingValue default: 33).
>>>    collected := uarray collect: [ :each | each ].
>>>    self assert: collected size equals: 3.
>>>    self assert: collected third equals: 33
>>>
>>>
>>> I basically started to implement
>>>
>>>
>>> do: aBlock
>>>    "Refer to the comment in Collection|do:."
>>>    1 to: self size do:
>>>        [:index | (self at: index) toDo: aBlock on: self]
>>>
>>>
>>>
>>> collect: aBlock
>>>    "Evaluate aBlock with each of the receiver's elements as the argument.
>>>    Collect the resulting values into a collection like the receiver. Answer
>>>    the new collection."
>>>
>>>    | newCollection |
>>>    newCollection := self species new.
>>>    self
>>>        do: [ :each | each toCollect: aBlock on: newCollection ].
>>>    ^ newCollection
>>>
>>>
>>> and
>>>
>>> DiscardingValue >> toCollect: aBlock on: aCollection
>>>    "discard computation"
>>>    ^ self
>>>
>>>
>>> Object >> toCollect: aBlock on: aCollection
>>>
>>>    ^ aCollection add: (aBlock value: self)
>>>
>>>
>>> So I imagine that you see the design and I wanted to get your point of view.
>>>
>>> --
>>> Using Opera a kind of bad mail client but far better than thunderbird
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>
> --
> www.tudorgirba.com
> www.feenk.com
>
> "If you interrupt the barber while he is cutting your hair,
> you will end up with a messy haircut."
>
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev



--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet



--
Using Opera's mail client: http://www.opera.com/mail/

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Design Challenge: metrics missing value...

abergel
In reply to this post by stepharong
> Doru I have multiple missingValue so that they embed their own strategy.
> Now I do not know for the scenario of alex.

For example, obtaining the classes for which metrics cannot be computed (e.g., source code is missing).

Alexandre


>
>>
>> Cheers,
>> Doru
>>
>>
>>> On Dec 21, 2016, at 8:13 AM, Alexandre Bergel <[hidden email]> wrote:
>>>
>>> Hi Stef,
>>>
>>> You are raising an interesting point to discuss. This MissingValue is indeed better than having -1
>>> Something to keep in mind: it may be that one would like to focus on the missing value and not really the value.
>>>
>>> Consider:
>>>
>>>> testCollect
>>>>
>>>> | uarray collected |
>>>> uarray := UniformOrderedCollection new.
>>>> uarray add: 10.
>>>> uarray add: 20.
>>>> uarray add: (MissingValue discarding).
>>>> collected := uarray collect: [ :each | each ].
>>>> self assert: collected size equals: 2.
>>>
>>> It could well be that I would like to be able to query over the MissingValue.
>>> Can something like possible: uarray collect: #isMissing
>>> ?
>>>
>>> Cheers,
>>> Alexandre
>>>
>>>
>>>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>>>
>>>> Hi dear great OO designers
>>>>
>>>> Here is a little challenges for your brainy souls :)
>>>>
>>>> In Moose when we compute metrics it may happen than a tool (often external to pharo) does not compute a metrics
>>>> and when we request it in moose we check and often we return a not so good -1.
>>>>
>>>> I'm trying to brainstorm on a solution
>>>>
>>>> - first may be the simplest way is to not invoke a metrics when it is not computed. But it means that we should know it and that we should have a registration mechanism. After all this is probably the best solution.
>>>>
>>>> - Second we were thinking to use exception but when we have multiple entities missing one metrics.... I have serious doubts.
>>>>
>>>> - Second I was thinking about having the following behavior
>>>>
>>>> testCollect
>>>>
>>>> | uarray collected |
>>>> uarray := UniformOrderedCollection new.
>>>> uarray add: 10.
>>>> uarray add: 20.
>>>> uarray add: (MissingValue discarding).
>>>> collected := uarray collect: [ :each | each ].
>>>> self assert: collected size equals: 2.
>>>>
>>>> testDo
>>>>
>>>> | res uarray |
>>>> uarray := UniformOrderedCollection new.
>>>> uarray add: 10.
>>>> uarray add: 20.
>>>> uarray add: (MissingValue discarding).
>>>> uarray add: 40.
>>>> res := 0.
>>>> uarray do: [ :each | res := res + each ].
>>>> self assert: res equals: 70.
>>>>
>>>>
>>>> testCollectDefaulting
>>>>
>>>> | uarray collected |
>>>> uarray := UniformOrderedCollection new.
>>>> uarray add: 10.
>>>> uarray add: 20.
>>>> uarray add: (MissingValue default: 33).
>>>> collected := uarray collect: [ :each | each ].
>>>> self assert: collected size equals: 3.
>>>> self assert: collected third equals: 33
>>>>
>>>>
>>>> I basically started to implement
>>>>
>>>>
>>>> do: aBlock
>>>> "Refer to the comment in Collection|do:."
>>>> 1 to: self size do:
>>>> [:index | (self at: index) toDo: aBlock on: self]
>>>>
>>>>
>>>>
>>>> collect: aBlock
>>>> "Evaluate aBlock with each of the receiver's elements as the argument.
>>>> Collect the resulting values into a collection like the receiver. Answer
>>>> the new collection."
>>>>
>>>> | newCollection |
>>>> newCollection := self species new.
>>>> self
>>>> do: [ :each | each toCollect: aBlock on: newCollection ].
>>>> ^ newCollection
>>>>
>>>>
>>>> and
>>>>
>>>> DiscardingValue >> toCollect: aBlock on: aCollection
>>>> "discard computation"
>>>> ^ self
>>>>
>>>>
>>>> Object >> toCollect: aBlock on: aCollection
>>>>
>>>> ^ aCollection add: (aBlock value: self)
>>>>
>>>>
>>>> So I imagine that you see the design and I wanted to get your point of view.
>>>>
>>>> --
>>>> Using Opera a kind of bad mail client but far better than thunderbird
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> [hidden email]
>>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>>
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>
>> --
>> www.tudorgirba.com
>> www.feenk.com
>>
>> "If you interrupt the barber while he is cutting your hair,
>> you will end up with a messy haircut."
>>
>>
>
>
> --
> Using Opera's mail client: http://www.opera.com/mail/
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Design Challenge: metrics missing value...

Tudor Girba-2
In reply to this post by stepharong
Hi,

> On Dec 21, 2016, at 3:05 PM, stepharong <[hidden email]> wrote:
>
>
>
>> Hi Alex,
>>
>> Following the design proposed by Stef, in your case you would use a different collection.
>
> Doru I have multiple missingValue so that they embed their own strategy.
> Now I do not know for the scenario of alex.

Yes, yes. And that is great.

It seemed to me that Alex wanted to find from the collection the elements that have a MissingValue, and for that he wants to use collect:. But, your collection collect: ignores the MissingValue. That is why I thought that he can serve his case with another collection type.

Cheers,
Doru


>>
>> Cheers,
>> Doru
>>
>>
>>> On Dec 21, 2016, at 8:13 AM, Alexandre Bergel <[hidden email]> wrote:
>>>
>>> Hi Stef,
>>>
>>> You are raising an interesting point to discuss. This MissingValue is indeed better than having -1
>>> Something to keep in mind: it may be that one would like to focus on the missing value and not really the value.
>>>
>>> Consider:
>>>
>>>> testCollect
>>>>
>>>> | uarray collected |
>>>> uarray := UniformOrderedCollection new.
>>>> uarray add: 10.
>>>> uarray add: 20.
>>>> uarray add: (MissingValue discarding).
>>>> collected := uarray collect: [ :each | each ].
>>>> self assert: collected size equals: 2.
>>>
>>> It could well be that I would like to be able to query over the MissingValue.
>>> Can something like possible: uarray collect: #isMissing
>>> ?
>>>
>>> Cheers,
>>> Alexandre
>>>
>>>
>>>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>>>
>>>> Hi dear great OO designers
>>>>
>>>> Here is a little challenges for your brainy souls :)
>>>>
>>>> In Moose when we compute metrics it may happen than a tool (often external to pharo) does not compute a metrics
>>>> and when we request it in moose we check and often we return a not so good -1.
>>>>
>>>> I'm trying to brainstorm on a solution
>>>>
>>>> - first may be the simplest way is to not invoke a metrics when it is not computed. But it means that we should know it and that we should have a registration mechanism. After all this is probably the best solution.
>>>>
>>>> - Second we were thinking to use exception but when we have multiple entities missing one metrics.... I have serious doubts.
>>>>
>>>> - Second I was thinking about having the following behavior
>>>>
>>>> testCollect
>>>>
>>>> | uarray collected |
>>>> uarray := UniformOrderedCollection new.
>>>> uarray add: 10.
>>>> uarray add: 20.
>>>> uarray add: (MissingValue discarding).
>>>> collected := uarray collect: [ :each | each ].
>>>> self assert: collected size equals: 2.
>>>>
>>>> testDo
>>>>
>>>> | res uarray |
>>>> uarray := UniformOrderedCollection new.
>>>> uarray add: 10.
>>>> uarray add: 20.
>>>> uarray add: (MissingValue discarding).
>>>> uarray add: 40.
>>>> res := 0.
>>>> uarray do: [ :each | res := res + each ].
>>>> self assert: res equals: 70.
>>>>
>>>>
>>>> testCollectDefaulting
>>>>
>>>> | uarray collected |
>>>> uarray := UniformOrderedCollection new.
>>>> uarray add: 10.
>>>> uarray add: 20.
>>>> uarray add: (MissingValue default: 33).
>>>> collected := uarray collect: [ :each | each ].
>>>> self assert: collected size equals: 3.
>>>> self assert: collected third equals: 33
>>>>
>>>>
>>>> I basically started to implement
>>>>
>>>>
>>>> do: aBlock
>>>> "Refer to the comment in Collection|do:."
>>>> 1 to: self size do:
>>>> [:index | (self at: index) toDo: aBlock on: self]
>>>>
>>>>
>>>>
>>>> collect: aBlock
>>>> "Evaluate aBlock with each of the receiver's elements as the argument.
>>>> Collect the resulting values into a collection like the receiver. Answer
>>>> the new collection."
>>>>
>>>> | newCollection |
>>>> newCollection := self species new.
>>>> self
>>>> do: [ :each | each toCollect: aBlock on: newCollection ].
>>>> ^ newCollection
>>>>
>>>>
>>>> and
>>>>
>>>> DiscardingValue >> toCollect: aBlock on: aCollection
>>>> "discard computation"
>>>> ^ self
>>>>
>>>>
>>>> Object >> toCollect: aBlock on: aCollection
>>>>
>>>> ^ aCollection add: (aBlock value: self)
>>>>
>>>>
>>>> So I imagine that you see the design and I wanted to get your point of view.
>>>>
>>>> --
>>>> Using Opera a kind of bad mail client but far better than thunderbird
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> [hidden email]
>>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>>
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>
>> --
>> www.tudorgirba.com
>> www.feenk.com
>>
>> "If you interrupt the barber while he is cutting your hair,
>> you will end up with a messy haircut."
>>
>>
>
>
> --
> Using Opera's mail client: http://www.opera.com/mail/

--
www.tudorgirba.com
www.feenk.com

“The smaller and more pervasive the hardware becomes, the more physical the software gets."

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Design Challenge: metrics missing value...

stepharong


Yes I see. I will keep thinking about it.

On Wed, 21 Dec 2016 20:58:26 +0100, Tudor Girba <[hidden email]>  
wrote:

> Hi,
>
>> On Dec 21, 2016, at 3:05 PM, stepharong <[hidden email]> wrote:
>>
>>
>>
>>> Hi Alex,
>>>
>>> Following the design proposed by Stef, in your case you would use a  
>>> different collection.
>>
>> Doru I have multiple missingValue so that they embed their own strategy.
>> Now I do not know for the scenario of alex.
>
> Yes, yes. And that is great.
>
> It seemed to me that Alex wanted to find from the collection the  
> elements that have a MissingValue, and for that he wants to use  
> collect:. But, your collection collect: ignores the MissingValue. That  
> is why I thought that he can serve his case with another collection type.
>
> Cheers,
> Doru
>
>
>>>
>>> Cheers,
>>> Doru
>>>
>>>
>>>> On Dec 21, 2016, at 8:13 AM, Alexandre Bergel  
>>>> <[hidden email]> wrote:
>>>>
>>>> Hi Stef,
>>>>
>>>> You are raising an interesting point to discuss. This MissingValue is  
>>>> indeed better than having -1
>>>> Something to keep in mind: it may be that one would like to focus on  
>>>> the missing value and not really the value.
>>>>
>>>> Consider:
>>>>
>>>>> testCollect
>>>>>
>>>>> | uarray collected |
>>>>> uarray := UniformOrderedCollection new.
>>>>> uarray add: 10.
>>>>> uarray add: 20.
>>>>> uarray add: (MissingValue discarding).
>>>>> collected := uarray collect: [ :each | each ].
>>>>> self assert: collected size equals: 2.
>>>>
>>>> It could well be that I would like to be able to query over the  
>>>> MissingValue.
>>>> Can something like possible: uarray collect: #isMissing
>>>> ?
>>>>
>>>> Cheers,
>>>> Alexandre
>>>>
>>>>
>>>>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>>>>
>>>>> Hi dear great OO designers
>>>>>
>>>>> Here is a little challenges for your brainy souls :)
>>>>>
>>>>> In Moose when we compute metrics it may happen than a tool (often  
>>>>> external to pharo) does not compute a metrics
>>>>> and when we request it in moose we check and often we return a not  
>>>>> so good -1.
>>>>>
>>>>> I'm trying to brainstorm on a solution
>>>>>
>>>>> - first may be the simplest way is to not invoke a metrics when it  
>>>>> is not computed. But it means that we should know it and that we  
>>>>> should have a registration mechanism. After all this is probably the  
>>>>> best solution.
>>>>>
>>>>> - Second we were thinking to use exception but when we have multiple  
>>>>> entities missing one metrics.... I have serious doubts.
>>>>>
>>>>> - Second I was thinking about having the following behavior
>>>>>
>>>>> testCollect
>>>>>
>>>>> | uarray collected |
>>>>> uarray := UniformOrderedCollection new.
>>>>> uarray add: 10.
>>>>> uarray add: 20.
>>>>> uarray add: (MissingValue discarding).
>>>>> collected := uarray collect: [ :each | each ].
>>>>> self assert: collected size equals: 2.
>>>>>
>>>>> testDo
>>>>>
>>>>> | res uarray |
>>>>> uarray := UniformOrderedCollection new.
>>>>> uarray add: 10.
>>>>> uarray add: 20.
>>>>> uarray add: (MissingValue discarding).
>>>>> uarray add: 40.
>>>>> res := 0.
>>>>> uarray do: [ :each | res := res + each ].
>>>>> self assert: res equals: 70.
>>>>>
>>>>>
>>>>> testCollectDefaulting
>>>>>
>>>>> | uarray collected |
>>>>> uarray := UniformOrderedCollection new.
>>>>> uarray add: 10.
>>>>> uarray add: 20.
>>>>> uarray add: (MissingValue default: 33).
>>>>> collected := uarray collect: [ :each | each ].
>>>>> self assert: collected size equals: 3.
>>>>> self assert: collected third equals: 33
>>>>>
>>>>>
>>>>> I basically started to implement
>>>>>
>>>>>
>>>>> do: aBlock
>>>>> "Refer to the comment in Collection|do:."
>>>>> 1 to: self size do:
>>>>> [:index | (self at: index) toDo: aBlock on: self]
>>>>>
>>>>>
>>>>>
>>>>> collect: aBlock
>>>>> "Evaluate aBlock with each of the receiver's elements as the  
>>>>> argument.
>>>>> Collect the resulting values into a collection like the receiver.  
>>>>> Answer
>>>>> the new collection."
>>>>>
>>>>> | newCollection |
>>>>> newCollection := self species new.
>>>>> self
>>>>> do: [ :each | each toCollect: aBlock on: newCollection ].
>>>>> ^ newCollection
>>>>>
>>>>>
>>>>> and
>>>>>
>>>>> DiscardingValue >> toCollect: aBlock on: aCollection
>>>>> "discard computation"
>>>>> ^ self
>>>>>
>>>>>
>>>>> Object >> toCollect: aBlock on: aCollection
>>>>>
>>>>> ^ aCollection add: (aBlock value: self)
>>>>>
>>>>>
>>>>> So I imagine that you see the design and I wanted to get your point  
>>>>> of view.
>>>>>
>>>>> --
>>>>> Using Opera a kind of bad mail client but far better than thunderbird
>>>>> _______________________________________________
>>>>> Moose-dev mailing list
>>>>> [hidden email]
>>>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>>>
>>>> --
>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>> Alexandre Bergel  http://www.bergel.eu
>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> [hidden email]
>>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>>
>>> --
>>> www.tudorgirba.com
>>> www.feenk.com
>>>
>>> "If you interrupt the barber while he is cutting your hair,
>>> you will end up with a messy haircut."
>>>
>>>
>>
>>
>> --
>> Using Opera's mail client: http://www.opera.com/mail/
>
> --
> www.tudorgirba.com
> www.feenk.com
>
> “The smaller and more pervasive the hardware becomes, the more physical  
> the software gets."
>


--
Using Opera's mail client: http://www.opera.com/mail/
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Design Challenge: metrics missing value...

SergeStinckwich
Something interesting about missing values and data-structure to
represent them like shadow matrix:

https://github.com/njtierney/naniar?utm_content=buffer26e7b

Some month ago, I build a Roassal viz in order to see missing values
in CSV file:
https://twitter.com/SergeStinckwich/status/705839378917167104


On Thu, Dec 22, 2016 at 9:34 AM, stepharong <[hidden email]> wrote:

>
>
> Yes I see. I will keep thinking about it.
>
>
> On Wed, 21 Dec 2016 20:58:26 +0100, Tudor Girba <[hidden email]>
> wrote:
>
>> Hi,
>>
>>> On Dec 21, 2016, at 3:05 PM, stepharong <[hidden email]> wrote:
>>>
>>>
>>>
>>>> Hi Alex,
>>>>
>>>> Following the design proposed by Stef, in your case you would use a
>>>> different collection.
>>>
>>>
>>> Doru I have multiple missingValue so that they embed their own strategy.
>>> Now I do not know for the scenario of alex.
>>
>>
>> Yes, yes. And that is great.
>>
>> It seemed to me that Alex wanted to find from the collection the elements
>> that have a MissingValue, and for that he wants to use collect:. But, your
>> collection collect: ignores the MissingValue. That is why I thought that he
>> can serve his case with another collection type.
>>
>> Cheers,
>> Doru
>>
>>
>>>>
>>>> Cheers,
>>>> Doru
>>>>
>>>>
>>>>> On Dec 21, 2016, at 8:13 AM, Alexandre Bergel <[hidden email]>
>>>>> wrote:
>>>>>
>>>>> Hi Stef,
>>>>>
>>>>> You are raising an interesting point to discuss. This MissingValue is
>>>>> indeed better than having -1
>>>>> Something to keep in mind: it may be that one would like to focus on
>>>>> the missing value and not really the value.
>>>>>
>>>>> Consider:
>>>>>
>>>>>> testCollect
>>>>>>
>>>>>>         | uarray collected |
>>>>>>         uarray := UniformOrderedCollection new.
>>>>>>         uarray add: 10.
>>>>>>         uarray add: 20.
>>>>>>         uarray add: (MissingValue discarding).
>>>>>>         collected := uarray collect: [ :each | each ].
>>>>>>         self assert: collected size equals: 2.
>>>>>
>>>>>
>>>>> It could well be that I would like to be able to query over the
>>>>> MissingValue.
>>>>> Can something like possible: uarray collect: #isMissing
>>>>> ?
>>>>>
>>>>> Cheers,
>>>>> Alexandre
>>>>>
>>>>>
>>>>>> On Dec 20, 2016, at 10:15 PM, stepharong <[hidden email]> wrote:
>>>>>>
>>>>>> Hi dear great OO designers
>>>>>>
>>>>>> Here is a little challenges for your brainy souls :)
>>>>>>
>>>>>> In Moose when we compute metrics it may happen than a tool (often
>>>>>> external to pharo) does not compute a metrics
>>>>>> and when we request it in moose we check and often we return a not so
>>>>>> good -1.
>>>>>>
>>>>>> I'm trying to brainstorm on a solution
>>>>>>
>>>>>> - first may be the simplest way is to not invoke a metrics when it is
>>>>>> not computed. But it means that we should know it and that we should have a
>>>>>> registration mechanism. After all this is probably the best solution.
>>>>>>
>>>>>> - Second we were thinking to use exception but when we have multiple
>>>>>> entities missing one metrics.... I have serious doubts.
>>>>>>
>>>>>> - Second I was thinking about having the following behavior
>>>>>>
>>>>>> testCollect
>>>>>>
>>>>>>         | uarray collected |
>>>>>>         uarray := UniformOrderedCollection new.
>>>>>>         uarray add: 10.
>>>>>>         uarray add: 20.
>>>>>>         uarray add: (MissingValue discarding).
>>>>>>         collected := uarray collect: [ :each | each ].
>>>>>>         self assert: collected size equals: 2.
>>>>>>
>>>>>> testDo
>>>>>>
>>>>>>         | res uarray |
>>>>>>         uarray := UniformOrderedCollection new.
>>>>>>         uarray add: 10.
>>>>>>         uarray add: 20.
>>>>>>         uarray add: (MissingValue discarding).
>>>>>>         uarray add: 40.
>>>>>>         res := 0.
>>>>>>         uarray do: [ :each | res := res + each ].
>>>>>>         self assert: res equals: 70.
>>>>>>
>>>>>>
>>>>>> testCollectDefaulting
>>>>>>
>>>>>>         | uarray collected |
>>>>>>         uarray := UniformOrderedCollection new.
>>>>>>         uarray add: 10.
>>>>>>         uarray add: 20.
>>>>>>         uarray add: (MissingValue default: 33).
>>>>>>         collected := uarray collect: [ :each | each ].
>>>>>>         self assert: collected size equals: 3.
>>>>>>         self assert: collected third equals: 33
>>>>>>
>>>>>>
>>>>>> I basically started to implement
>>>>>>
>>>>>>
>>>>>> do: aBlock
>>>>>>         "Refer to the comment in Collection|do:."
>>>>>>         1 to: self size do:
>>>>>>                 [:index | (self at: index) toDo: aBlock on: self]
>>>>>>
>>>>>>
>>>>>>
>>>>>> collect: aBlock
>>>>>>         "Evaluate aBlock with each of the receiver's elements as the
>>>>>> argument.
>>>>>>         Collect the resulting values into a collection like the
>>>>>> receiver. Answer
>>>>>>         the new collection."
>>>>>>
>>>>>>         | newCollection |
>>>>>>         newCollection := self species new.
>>>>>>         self
>>>>>>                 do: [ :each | each toCollect: aBlock on: newCollection
>>>>>> ].
>>>>>>         ^ newCollection
>>>>>>
>>>>>>
>>>>>> and
>>>>>>
>>>>>> DiscardingValue >> toCollect: aBlock on: aCollection
>>>>>>         "discard computation"
>>>>>>         ^ self
>>>>>>
>>>>>>
>>>>>> Object >> toCollect: aBlock on: aCollection
>>>>>>
>>>>>>         ^ aCollection add: (aBlock value: self)
>>>>>>
>>>>>>
>>>>>> So I imagine that you see the design and I wanted to get your point of
>>>>>> view.
>>>>>>
>>>>>> --
>>>>>> Using Opera a kind of bad mail client but far better than thunderbird
>>>>>> _______________________________________________
>>>>>> Moose-dev mailing list
>>>>>> [hidden email]
>>>>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>>>>
>>>>>
>>>>> --
>>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>>> Alexandre Bergel  http://www.bergel.eu
>>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Moose-dev mailing list
>>>>> [hidden email]
>>>>> https://www.list.inf.unibe.ch/listinfo/moose-dev
>>>>
>>>>
>>>> --
>>>> www.tudorgirba.com
>>>> www.feenk.com
>>>>
>>>> "If you interrupt the barber while he is cutting your hair,
>>>> you will end up with a messy haircut."
>>>>
>>>>
>>>
>>>
>>> --
>>> Using Opera's mail client: http://www.opera.com/mail/
>>
>>
>> --
>> www.tudorgirba.com
>> www.feenk.com
>>
>> “The smaller and more pervasive the hardware becomes, the more physical
>> the software gets."
>>
>
>
> --
> Using Opera's mail client: http://www.opera.com/mail/
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev



--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Loading...