Supporting reuse of composed metrics out of elementary metrics from different tools.

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

Supporting reuse of composed metrics out of elementary metrics from different tools.

Stéphane Ducasse
Hi guys

We wanted to reuse metrics computation for example alves ratio (shown below) but for metrics imported from different tools like understand or sonar.

calculateAlvesRatio
“note that we do not know if this definition is correct but we want to reuse it"
^ self numberOfLinesOfCode / self lcom3

We wanted to avoid to reify all the metrics to avoid to blow memory (yes Cyril we the researchers are not totally dummy :).

Here is a solution: double dispatch :)
So tell us. 



FAMIXClass >> calculateAlvesLCOMRatio
^ (self family numberOfLinesOfCodeForClass: self) / (self family lcomForClass: self)

MooseFamily >> lcomForClass: aClass
^ aClass lcom3

MooseFamily >> numberOfLinesOfCodeForClass: aClass
^ aClass numberOfLinesOfCode


UnderstandFamily >> lcomForClass: aClass
^ aClass understand_LCOM

UnderstandFamily >> numberOfLinesOfCodeForClass: aClass
^ aClass understand_LoC



testClassLinesOfCodeWithMooseFamily
"self nodeClass propertyNamed: #family put: FamixFamily uniqueInstance."

self nodeClass familyClass: MooseFamily.
self assert: self nodeClass numberOfLinesOfCode equals: 58.
self assert: self nodeClass lcom3 equals: 10 / 11.
self assert: self nodeClass calculateAlvesLCOMRatio equals: 319 / 5


testClassLinesOfCodeWithUnderstandFamily
self nodeClass familyClass: UnderstandFamily.
self nodeClass
propertyNamed: #understand_LoC put: 85;
propertyNamed: #understand_LCOM put: 11.
self assert: self nodeClass calculateAlvesLCOMRatio equals: 85 / 11

Comments are welcome and code available at: 

MCSmalltalkhubRepository
owner: 'Moose'
project: 'Moose'
user: ''
password: ‘'

Stef


--------------------------------------------
Stéphane Ducasse
03 59 35 87 52
Assistant: Julie Jonas 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France


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