Metric for Smalltalk code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Metric for Smalltalk code

abergel
Hi!

Metrics for smalltalk code are lazy computed. It is only when you send #numberOfLinesOfCode to a class or a method that the value is actually computed from the code present in the image.

The current schema is not really optimal when loading multiple versions.
The problem we are facing is that we need to manually call the metric methods after each version is loaded.

Is there a way to force the metrics to be computed while importing code?

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





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

Re: Metric for Smalltalk code

Tudor Girba-2
We have done this because in most cases, we only need a couple of metrics and thus it is not useful to spend a tone of time computing all metrics.

Currently, there is nothing out of the box that would force the computation of all metrics. However, it should not be hard to do. For example:

model allClasses do: [:eachEntity |
        eachEntity mooseDescription allPrimitiveAttributes do: [:eachProperty |
                eachEntity mmGetProperty: eachProperty ] ]

Doru

On 21 Nov 2011, at 20:58, Alexandre Bergel wrote:

> Hi!
>
> Metrics for smalltalk code are lazy computed. It is only when you send #numberOfLinesOfCode to a class or a method that the value is actually computed from the code present in the image.
>
> The current schema is not really optimal when loading multiple versions.
> The problem we are facing is that we need to manually call the metric methods after each version is loaded.
>
> Is there a way to force the metrics to be computed while importing code?
>
> Cheers,
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
www.tudorgirba.com

"Some battles are better lost than fought."




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

Re: Metric for Smalltalk code

Stéphane Ducasse
In reply to this post by abergel

> Hi!
>
> Metrics for smalltalk code are lazy computed. It is only when you send #numberOfLinesOfCode to a class or a method that the value is actually computed from the code present in the image.
>
> The current schema is not really optimal when loading multiple versions.
> The problem we are facing is that we need to manually call the metric methods after each version is loaded.
>
> Is there a way to force the metrics to be computed while importing code?

excellent!
I wanted to add post importer plugin logic  and this is typically what you want to do.
So like that we can benefit from the new infrastructure (lazy) and the old way (plugin).

So I will try to find some time to implement that.

Stef

>
> Cheers,
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


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

Re: Metric for Smalltalk code

abergel
In reply to this post by Tudor Girba-2
I basically see two ways of achieving this:

1 - Putting a new variable 'computeMetricsLazily' in MooseImportingContext.
2 - Another option is to add a method MooseModel>>computeAllMetrics

Option seems cleaner to me.
Any further comment before I put my hand on the keyboard?

Alexandre

On 22 Nov 2011, at 04:16, Tudor Girba wrote:

> We have done this because in most cases, we only need a couple of metrics and thus it is not useful to spend a tone of time computing all metrics.
>
> Currently, there is nothing out of the box that would force the computation of all metrics. However, it should not be hard to do. For example:
>
> model allClasses do: [:eachEntity |
> eachEntity mooseDescription allPrimitiveAttributes do: [:eachProperty |
> eachEntity mmGetProperty: eachProperty ] ]
>
> Doru
>
> On 21 Nov 2011, at 20:58, Alexandre Bergel wrote:
>
>> Hi!
>>
>> Metrics for smalltalk code are lazy computed. It is only when you send #numberOfLinesOfCode to a class or a method that the value is actually computed from the code present in the image.
>>
>> The current schema is not really optimal when loading multiple versions.
>> The problem we are facing is that we need to manually call the metric methods after each version is loaded.
>>
>> Is there a way to force the metrics to be computed while importing code?
>>
>> Cheers,
>> Alexandre
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> www.tudorgirba.com
>
> "Some battles are better lost than fought."
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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





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

Re: Metric for Smalltalk code

Tudor Girba-2
Which option?

Doru

On Tue, Nov 22, 2011 at 1:38 PM, Alexandre Bergel
<[hidden email]> wrote:

> I basically see two ways of achieving this:
>
> 1 - Putting a new variable 'computeMetricsLazily' in MooseImportingContext.
> 2 - Another option is to add a method MooseModel>>computeAllMetrics
>
> Option seems cleaner to me.
> Any further comment before I put my hand on the keyboard?
>
> Alexandre
>
> On 22 Nov 2011, at 04:16, Tudor Girba wrote:
>
>> We have done this because in most cases, we only need a couple of metrics and thus it is not useful to spend a tone of time computing all metrics.
>>
>> Currently, there is nothing out of the box that would force the computation of all metrics. However, it should not be hard to do. For example:
>>
>> model allClasses do: [:eachEntity |
>>       eachEntity mooseDescription allPrimitiveAttributes do: [:eachProperty |
>>               eachEntity mmGetProperty: eachProperty ] ]
>>
>> Doru
>>
>> On 21 Nov 2011, at 20:58, Alexandre Bergel wrote:
>>
>>> Hi!
>>>
>>> Metrics for smalltalk code are lazy computed. It is only when you send #numberOfLinesOfCode to a class or a method that the value is actually computed from the code present in the image.
>>>
>>> The current schema is not really optimal when loading multiple versions.
>>> The problem we are facing is that we need to manually call the metric methods after each version is loaded.
>>>
>>> Is there a way to force the metrics to be computed while importing code?
>>>
>>> Cheers,
>>> Alexandre
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>> --
>> www.tudorgirba.com
>>
>> "Some battles are better lost than fought."
>>
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>



--
www.tudorgirba.com
"Every thing has its own flow"

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

Re: Metric for Smalltalk code

abergel
A wrong keystroke has sent the email before it was finished.

It seems to me that :
>> 1 - Putting a new variable 'computeMetricsLazily' in MooseImportingContext.

is the cleaner way. As stef said, this will have an impact on the importer, but a very small one. The importer has to execute a similar piece of code that you suggested.

Alexandre


On 22 Nov 2011, at 10:02, Tudor Girba wrote:

> Which option?
>
> Doru
>
> On Tue, Nov 22, 2011 at 1:38 PM, Alexandre Bergel
> <[hidden email]> wrote:
>> I basically see two ways of achieving this:
>>
>> 1 - Putting a new variable 'computeMetricsLazily' in MooseImportingContext.
>> 2 - Another option is to add a method MooseModel>>computeAllMetrics
>>
>> Option seems cleaner to me.
>> Any further comment before I put my hand on the keyboard?
>>
>> Alexandre
>>
>> On 22 Nov 2011, at 04:16, Tudor Girba wrote:
>>
>>> We have done this because in most cases, we only need a couple of metrics and thus it is not useful to spend a tone of time computing all metrics.
>>>
>>> Currently, there is nothing out of the box that would force the computation of all metrics. However, it should not be hard to do. For example:
>>>
>>> model allClasses do: [:eachEntity |
>>>       eachEntity mooseDescription allPrimitiveAttributes do: [:eachProperty |
>>>               eachEntity mmGetProperty: eachProperty ] ]
>>>
>>> Doru
>>>
>>> On 21 Nov 2011, at 20:58, Alexandre Bergel wrote:
>>>
>>>> Hi!
>>>>
>>>> Metrics for smalltalk code are lazy computed. It is only when you send #numberOfLinesOfCode to a class or a method that the value is actually computed from the code present in the image.
>>>>
>>>> The current schema is not really optimal when loading multiple versions.
>>>> The problem we are facing is that we need to manually call the metric methods after each version is loaded.
>>>>
>>>> Is there a way to force the metrics to be computed while importing code?
>>>>
>>>> Cheers,
>>>> Alexandre
>>>> --
>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>> Alexandre Bergel  http://www.bergel.eu
>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> [hidden email]
>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>> --
>>> www.tudorgirba.com
>>>
>>> "Some battles are better lost than fought."
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>
>
>
> --
> www.tudorgirba.com
> "Every thing has its own flow"
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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





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

Re: Metric for Smalltalk code

abergel
Hi!

I tried to extend the importing context with a variable computeMetricsAfterImport. However this more complex than expected.

Some metrics cannot be computed for a famix element that does not belong to a moose model. This is the case for example if you send #numberOfLinesOfCode to a famix method. It is necessary to know whether the model is a Smalltalk model or not.

This means that MooseImportClassesTask cannot ask for the metrics to be computed, since the famix elements do not belong to a model.

All in all, it seems that the easiest way to do it is to have a method MooseModel>>computeAllMetrics. No need to extend the importing context and the importer in that case.

Not really great in my opinion, but this is the simplest thing.
Any opinion?

Alexandre


On 22 Nov 2011, at 10:07, Alexandre Bergel wrote:

> A wrong keystroke has sent the email before it was finished.
>
> It seems to me that :
>>> 1 - Putting a new variable 'computeMetricsLazily' in MooseImportingContext.
>
> is the cleaner way. As stef said, this will have an impact on the importer, but a very small one. The importer has to execute a similar piece of code that you suggested.
>
> Alexandre
>
>
> On 22 Nov 2011, at 10:02, Tudor Girba wrote:
>
>> Which option?
>>
>> Doru
>>
>> On Tue, Nov 22, 2011 at 1:38 PM, Alexandre Bergel
>> <[hidden email]> wrote:
>>> I basically see two ways of achieving this:
>>>
>>> 1 - Putting a new variable 'computeMetricsLazily' in MooseImportingContext.
>>> 2 - Another option is to add a method MooseModel>>computeAllMetrics
>>>
>>> Option seems cleaner to me.
>>> Any further comment before I put my hand on the keyboard?
>>>
>>> Alexandre
>>>
>>> On 22 Nov 2011, at 04:16, Tudor Girba wrote:
>>>
>>>> We have done this because in most cases, we only need a couple of metrics and thus it is not useful to spend a tone of time computing all metrics.
>>>>
>>>> Currently, there is nothing out of the box that would force the computation of all metrics. However, it should not be hard to do. For example:
>>>>
>>>> model allClasses do: [:eachEntity |
>>>>      eachEntity mooseDescription allPrimitiveAttributes do: [:eachProperty |
>>>>              eachEntity mmGetProperty: eachProperty ] ]
>>>>
>>>> Doru
>>>>
>>>> On 21 Nov 2011, at 20:58, Alexandre Bergel wrote:
>>>>
>>>>> Hi!
>>>>>
>>>>> Metrics for smalltalk code are lazy computed. It is only when you send #numberOfLinesOfCode to a class or a method that the value is actually computed from the code present in the image.
>>>>>
>>>>> The current schema is not really optimal when loading multiple versions.
>>>>> The problem we are facing is that we need to manually call the metric methods after each version is loaded.
>>>>>
>>>>> Is there a way to force the metrics to be computed while importing code?
>>>>>
>>>>> Cheers,
>>>>> Alexandre
>>>>> --
>>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>>> Alexandre Bergel  http://www.bergel.eu
>>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Moose-dev mailing list
>>>>> [hidden email]
>>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>
>>>> --
>>>> www.tudorgirba.com
>>>>
>>>> "Some battles are better lost than fought."
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> [hidden email]
>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>
>>
>>
>> --
>> www.tudorgirba.com
>> "Every thing has its own flow"
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>

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





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

Re: Metric for Smalltalk code

Stéphane Ducasse
I would not put it in the model

In fact that CompositeImporterTask should be able to run plugin once the model is created.
and we can register a simple MooseTask
                                                ComputerMetrics

I was more or less like that in VW before the compute* methods.
                                                       
Stef


On Nov 22, 2011, at 4:49 PM, Alexandre Bergel wrote:

> Hi!
>
> I tried to extend the importing context with a variable computeMetricsAfterImport. However this more complex than expected.
>
> Some metrics cannot be computed for a famix element that does not belong to a moose model. This is the case for example if you send #numberOfLinesOfCode to a famix method. It is necessary to know whether the model is a Smalltalk model or not.
>
> This means that MooseImportClassesTask cannot ask for the metrics to be computed, since the famix elements do not belong to a model.
>
> All in all, it seems that the easiest way to do it is to have a method MooseModel>>computeAllMetrics. No need to extend the importing context and the importer in that case.
>
> Not really great in my opinion, but this is the simplest thing.
> Any opinion?
>
> Alexandre
>
>
> On 22 Nov 2011, at 10:07, Alexandre Bergel wrote:
>
>> A wrong keystroke has sent the email before it was finished.
>>
>> It seems to me that :
>>>> 1 - Putting a new variable 'computeMetricsLazily' in MooseImportingContext.
>>
>> is the cleaner way. As stef said, this will have an impact on the importer, but a very small one. The importer has to execute a similar piece of code that you suggested.
>>
>> Alexandre
>>
>>
>> On 22 Nov 2011, at 10:02, Tudor Girba wrote:
>>
>>> Which option?
>>>
>>> Doru
>>>
>>> On Tue, Nov 22, 2011 at 1:38 PM, Alexandre Bergel
>>> <[hidden email]> wrote:
>>>> I basically see two ways of achieving this:
>>>>
>>>> 1 - Putting a new variable 'computeMetricsLazily' in MooseImportingContext.
>>>> 2 - Another option is to add a method MooseModel>>computeAllMetrics
>>>>
>>>> Option seems cleaner to me.
>>>> Any further comment before I put my hand on the keyboard?
>>>>
>>>> Alexandre
>>>>
>>>> On 22 Nov 2011, at 04:16, Tudor Girba wrote:
>>>>
>>>>> We have done this because in most cases, we only need a couple of metrics and thus it is not useful to spend a tone of time computing all metrics.
>>>>>
>>>>> Currently, there is nothing out of the box that would force the computation of all metrics. However, it should not be hard to do. For example:
>>>>>
>>>>> model allClasses do: [:eachEntity |
>>>>>     eachEntity mooseDescription allPrimitiveAttributes do: [:eachProperty |
>>>>>             eachEntity mmGetProperty: eachProperty ] ]
>>>>>
>>>>> Doru
>>>>>
>>>>> On 21 Nov 2011, at 20:58, Alexandre Bergel wrote:
>>>>>
>>>>>> Hi!
>>>>>>
>>>>>> Metrics for smalltalk code are lazy computed. It is only when you send #numberOfLinesOfCode to a class or a method that the value is actually computed from the code present in the image.
>>>>>>
>>>>>> The current schema is not really optimal when loading multiple versions.
>>>>>> The problem we are facing is that we need to manually call the metric methods after each version is loaded.
>>>>>>
>>>>>> Is there a way to force the metrics to be computed while importing code?
>>>>>>
>>>>>> Cheers,
>>>>>> Alexandre
>>>>>> --
>>>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>>>> Alexandre Bergel  http://www.bergel.eu
>>>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Moose-dev mailing list
>>>>>> [hidden email]
>>>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>>
>>>>> --
>>>>> www.tudorgirba.com
>>>>>
>>>>> "Some battles are better lost than fought."
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Moose-dev mailing list
>>>>> [hidden email]
>>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>
>>>> --
>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>> Alexandre Bergel  http://www.bergel.eu
>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> [hidden email]
>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>
>>>
>>>
>>>
>>> --
>>> www.tudorgirba.com
>>> "Every thing has its own flow"
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


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

Re: Metric for Smalltalk code

abergel
Well said!

Added the metric ComputingAllMetricsTask in Famix-Extensions-AlexandreBergel.209
(I made sure I added a class comment on the task)
Famix-Tests-Extensions-AlexandreBergel.11 now contains: ComputingAllMetricsTaskTest

The comment:
-=-=-=-=-=-=-=-=-=
Compute all the metrics of each entity of a model.
This is interesting only for Smalltalk model.
Currently, the model may access the Smalltalk source code in order to compute metrics, since they are lazily computed.

Example of usage:
        ComputingAllMetricsTask runOnModel: model.
-=-=-=-=-=-=-=-=-=

In the mean time, I also reorganized the method of MooseCustomTask

Really cool this idea of Task. Indeed, they could be well used in Pharo.

Cheers,
Alexandre


On 22 Nov 2011, at 18:45, Stéphane Ducasse wrote:

> I would not put it in the model
>
> In fact that CompositeImporterTask should be able to run plugin once the model is created.
> and we can register a simple MooseTask
> ComputerMetrics
>
> I was more or less like that in VW before the compute* methods.
>
> Stef
>
>
> On Nov 22, 2011, at 4:49 PM, Alexandre Bergel wrote:
>
>> Hi!
>>
>> I tried to extend the importing context with a variable computeMetricsAfterImport. However this more complex than expected.
>>
>> Some metrics cannot be computed for a famix element that does not belong to a moose model. This is the case for example if you send #numberOfLinesOfCode to a famix method. It is necessary to know whether the model is a Smalltalk model or not.
>>
>> This means that MooseImportClassesTask cannot ask for the metrics to be computed, since the famix elements do not belong to a model.
>>
>> All in all, it seems that the easiest way to do it is to have a method MooseModel>>computeAllMetrics. No need to extend the importing context and the importer in that case.
>>
>> Not really great in my opinion, but this is the simplest thing.
>> Any opinion?
>>
>> Alexandre
>>
>>
>> On 22 Nov 2011, at 10:07, Alexandre Bergel wrote:
>>
>>> A wrong keystroke has sent the email before it was finished.
>>>
>>> It seems to me that :
>>>>> 1 - Putting a new variable 'computeMetricsLazily' in MooseImportingContext.
>>>
>>> is the cleaner way. As stef said, this will have an impact on the importer, but a very small one. The importer has to execute a similar piece of code that you suggested.
>>>
>>> Alexandre
>>>
>>>
>>> On 22 Nov 2011, at 10:02, Tudor Girba wrote:
>>>
>>>> Which option?
>>>>
>>>> Doru
>>>>
>>>> On Tue, Nov 22, 2011 at 1:38 PM, Alexandre Bergel
>>>> <[hidden email]> wrote:
>>>>> I basically see two ways of achieving this:
>>>>>
>>>>> 1 - Putting a new variable 'computeMetricsLazily' in MooseImportingContext.
>>>>> 2 - Another option is to add a method MooseModel>>computeAllMetrics
>>>>>
>>>>> Option seems cleaner to me.
>>>>> Any further comment before I put my hand on the keyboard?
>>>>>
>>>>> Alexandre
>>>>>
>>>>> On 22 Nov 2011, at 04:16, Tudor Girba wrote:
>>>>>
>>>>>> We have done this because in most cases, we only need a couple of metrics and thus it is not useful to spend a tone of time computing all metrics.
>>>>>>
>>>>>> Currently, there is nothing out of the box that would force the computation of all metrics. However, it should not be hard to do. For example:
>>>>>>
>>>>>> model allClasses do: [:eachEntity |
>>>>>>    eachEntity mooseDescription allPrimitiveAttributes do: [:eachProperty |
>>>>>>            eachEntity mmGetProperty: eachProperty ] ]
>>>>>>
>>>>>> Doru
>>>>>>
>>>>>> On 21 Nov 2011, at 20:58, Alexandre Bergel wrote:
>>>>>>
>>>>>>> Hi!
>>>>>>>
>>>>>>> Metrics for smalltalk code are lazy computed. It is only when you send #numberOfLinesOfCode to a class or a method that the value is actually computed from the code present in the image.
>>>>>>>
>>>>>>> The current schema is not really optimal when loading multiple versions.
>>>>>>> The problem we are facing is that we need to manually call the metric methods after each version is loaded.
>>>>>>>
>>>>>>> Is there a way to force the metrics to be computed while importing code?
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Alexandre
>>>>>>> --
>>>>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>>>>> Alexandre Bergel  http://www.bergel.eu
>>>>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Moose-dev mailing list
>>>>>>> [hidden email]
>>>>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>>>
>>>>>> --
>>>>>> www.tudorgirba.com
>>>>>>
>>>>>> "Some battles are better lost than fought."
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Moose-dev mailing list
>>>>>> [hidden email]
>>>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>>
>>>>> --
>>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>>> Alexandre Bergel  http://www.bergel.eu
>>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Moose-dev mailing list
>>>>> [hidden email]
>>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> www.tudorgirba.com
>>>> "Every thing has its own flow"
>>>>
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> [hidden email]
>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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






_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev