Hi!
I have been looking for a method that give me the depth of the class hierarchy under a particular class. Doru pointed me the method FAMIXClass>>maxHierarchyOfChildren. But I was not able to make it work. I imported Morph into moose, and try to send #maxHierarchyOfChildren to the famix representation of Canvas or Morph. It simply loops. #maxHierarchyOfChildren and its unique caller (#ahh) are not tested. I try to look at the implementation of maxHierarchyOfChildren, but it was a bit obscure to me (almost midnight here :) I decided to write my own: -=-=-=-=-=-=-=-=-=-=-=-= FAMIXClass>>subclassHierarchyDepth <property: #SHD longName: 'Subclass hierarchy Depth' description: 'The depth of the class hierarchy for which I am the root'> ^ (self directSubclasses isEmpty or: [ self isStub ]) ifTrue: [ 0 ] ifFalse: [ | currentMaxDepth| currentMaxDepth := 0. self subclassesDo: [ :aClass | currentMaxDepth := currentMaxDepth max: aClass subclassHierarchyDepth ]. 1 + currentMaxDepth ] -=-=-=-=-=-=-=-=-=-=-=-= Any one can comment on maxHierarchyOfChildren? Does it make sense to remove maxHierarchyOfChildren and add my subclassHierarchyDepth? Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi Alex,
I do not see how you got a loop in the maxHierarchyOfChildren, but in any case the implementation was not good. I like yours much better. Please remove the maxHierarchyOfChildren (I do not like the name either :)) and replace it with your method. Cheers, Doru On 26 Apr 2010, at 05:15, Alexandre Bergel wrote: > Hi! > > I have been looking for a method that give me the depth of the class > hierarchy under a particular class. Doru pointed me the method > FAMIXClass>>maxHierarchyOfChildren. But I was not able to make it > work. > > I imported Morph into moose, and try to send #maxHierarchyOfChildren > to the famix representation of Canvas or Morph. It simply loops. > > #maxHierarchyOfChildren and its unique caller (#ahh) are not tested. > I try to look at the implementation of maxHierarchyOfChildren, but > it was a bit obscure to me (almost midnight here :) I decided to > write my own: > > -=-=-=-=-=-=-=-=-=-=-=-= > FAMIXClass>>subclassHierarchyDepth > <property: #SHD longName: 'Subclass hierarchy Depth' description: > 'The depth of the class hierarchy for which I am the root'> > > > ^ (self directSubclasses isEmpty or: [ self isStub ]) > ifTrue: [ 0 ] > ifFalse: > [ | currentMaxDepth| > currentMaxDepth := 0. > self > subclassesDo: > [ :aClass | currentMaxDepth := currentMaxDepth max: aClass > subclassHierarchyDepth ]. > 1 + currentMaxDepth ] > -=-=-=-=-=-=-=-=-=-=-=-= > > Any one can comment on maxHierarchyOfChildren? Does it make sense to > remove maxHierarchyOfChildren and add my subclassHierarchyDepth? > > 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 "Every now and then stop and ask yourself if the war you're fighting is the right one." _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by Alexandre Bergel
Hi! I replaced maxHierarchyOfChildren by subclassHierarchyDepth in Famix-Extensions. This method is tested in GroupTest. I am not sure this is the right place to test it. If someone has a better location, I am happy to change it. I also added a test for the ahh metric. Cyrille, I change the definition of ahh, maybe you want to have a look at it. I am not sure whether I preserved its behavior or not. Check #testAverageHierarchyHeight please. Comment of Famix-Extensions-AlexandreBergel.120: -=-=-=-=-=-=-=-=-=-=-=-= Removed maxHierarchyOfChildren from FAMIXClass and added subclassHierarchyDepth. Provide a better version (I hope :) of MooseGroup>>ahh. These two methods are tested in GroupTest, class that belongs to Moose-ModelTest -=-=-=-=-=-=-=-=-=-=-=-= Comment of Moose-ModelTest-AlexandreBergel.60: -=-=-=-=-=-=-=-=-=-=-=-= I moved the method GroupTest>>model from 'unclassified category' to a new method category called 'utility'. Added GroupTest>>testAverageHierarchyHeight and GroupTest>>testSubclassHierarchyDepth -=-=-=-=-=-=-=-=-=-=-=-= Cheers, Alexandre -- View this message in context: http://moose-dev.97923.n3.nabble.com/Getting-the-depth-of-the-subclass-hierarchy-tp755716p768907.html Sent from the moose-dev mailing list archive at Nabble.com. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi Alex,
Great, but you should put the tests related to FAMIX in Famix-Tests- Core. Cheers, Doru On 30 Apr 2010, at 23:17, Alexandre Bergel wrote: > > Hi! > > I replaced maxHierarchyOfChildren by subclassHierarchyDepth in > Famix-Extensions. This method is tested in GroupTest. I am not sure > this is > the right place to test it. If someone has a better location, I am > happy to > change it. > > I also added a test for the ahh metric. Cyrille, I change the > definition of > ahh, maybe you want to have a look at it. I am not sure whether I > preserved > its behavior or not. Check #testAverageHierarchyHeight please. > > Comment of Famix-Extensions-AlexandreBergel.120: > -=-=-=-=-=-=-=-=-=-=-=-= > Removed maxHierarchyOfChildren from FAMIXClass and added > subclassHierarchyDepth. > Provide a better version (I hope :) of MooseGroup>>ahh. > > These two methods are tested in GroupTest, class that belongs to > Moose-ModelTest > -=-=-=-=-=-=-=-=-=-=-=-= > > Comment of Moose-ModelTest-AlexandreBergel.60: > -=-=-=-=-=-=-=-=-=-=-=-= > I moved the method GroupTest>>model from 'unclassified category' to > a new > method category called 'utility'. > > Added GroupTest>>testAverageHierarchyHeight and > GroupTest>>testSubclassHierarchyDepth > -=-=-=-=-=-=-=-=-=-=-=-= > > Cheers, > Alexandre > > > > -- > View this message in context: http://moose-dev.97923.n3.nabble.com/Getting-the-depth-of-the-subclass-hierarchy-tp755716p768907.html > Sent from the moose-dev mailing list archive at Nabble.com. > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- www.tudorgirba.com "Problem solving efficiency grows with the abstractness level of problem understanding." _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Done. But Famix-Tests-Core is almost empty. It contains only 3 tests.
I created a class FAMIXMetricTest and moved testAverageHierarchyHeight and testSubclassHierarchyDepth in it. New versions: Famix-Tests-Core-Alexandre_Bergel.3 Moose-ModelTest-Alexandre_Bergel.63 Cheers, Alexandre On 30 Apr 2010, at 17:42, Tudor Girba wrote: > Hi Alex, > > Great, but you should put the tests related to FAMIX in Famix-Tests- > Core. > > Cheers, > Doru > > On 30 Apr 2010, at 23:17, Alexandre Bergel wrote: > >> >> Hi! >> >> I replaced maxHierarchyOfChildren by subclassHierarchyDepth in >> Famix-Extensions. This method is tested in GroupTest. I am not sure >> this is >> the right place to test it. If someone has a better location, I am >> happy to >> change it. >> >> I also added a test for the ahh metric. Cyrille, I change the >> definition of >> ahh, maybe you want to have a look at it. I am not sure whether I >> preserved >> its behavior or not. Check #testAverageHierarchyHeight please. >> >> Comment of Famix-Extensions-AlexandreBergel.120: >> -=-=-=-=-=-=-=-=-=-=-=-= >> Removed maxHierarchyOfChildren from FAMIXClass and added >> subclassHierarchyDepth. >> Provide a better version (I hope :) of MooseGroup>>ahh. >> >> These two methods are tested in GroupTest, class that belongs to >> Moose-ModelTest >> -=-=-=-=-=-=-=-=-=-=-=-= >> >> Comment of Moose-ModelTest-AlexandreBergel.60: >> -=-=-=-=-=-=-=-=-=-=-=-= >> I moved the method GroupTest>>model from 'unclassified category' to >> a new >> method category called 'utility'. >> >> Added GroupTest>>testAverageHierarchyHeight and >> GroupTest>>testSubclassHierarchyDepth >> -=-=-=-=-=-=-=-=-=-=-=-= >> >> Cheers, >> Alexandre >> >> >> >> -- >> View this message in context: http://moose-dev.97923.n3.nabble.com/Getting-the-depth-of-the-subclass-hierarchy-tp755716p768907.html >> Sent from the moose-dev mailing list archive at Nabble.com. >> _______________________________________________ >> Moose-dev mailing list >> [hidden email] >> https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > -- > www.tudorgirba.com > > "Problem solving efficiency grows with the abstractness level of > problem understanding." > > > > _______________________________________________ > 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 |
Free forum by Nabble | Edit this page |