On 16/10/12 11:22, Tudor Girba wrote:
I have been willing to push moosechef for more than a year I think :-(
I will try to put some effort there

Great. This is indeed a large and vague task. Let's synchronize around it and create detailed tasks. Could you propose a small set?
 
Cheers,
Doru

I spent a lot of time today trying to figure this out with Moose.
Kind of "eat your own dog food" experience.
But with no success (with Moose alone).


So I went for something less radical, here are some numbers:

1- find all method protocols implementing Cook or navigation methods

(FAMIXNamedEntity withAllSubclasses flatCollectAsSet: [:c | c protocols]) select: [:s | s beginsWith: '*Famix-Extensions']
-> 5
(FAMIXNamedEntity withAllSubclasses flatCollectAsSet: [:c | c protocols]) select: [:s | s beginsWith: '*famix-extensions']
-> 29

+ select manually the relevant ones
-> 20
cookProtocols := {
'*famix-extensions-nav Potential Incoming Invocations' .
'*famix-extensions-cook-Private' .
'*famix-extensions-cook-SureOutgoingInvocations' .
'*famix-extensions-nav All Dependencies' .
'*famix-extensions-nav Static Dependencies' .
'*famix-extensions-cook-StaticAccesses' .
'*famix-extensions-nav All Incoming Invocations' .
'*famix-extensions-nav Sure Outgoing Dependencies' .
'*famix-extensions-nav Potential Outgoing Invocations' .
'*famix-extensions-invocations' .
'*famix-extensions-nav Sure Incoming Invocations' .
'*famix-extensions-NavPrivate' .
'*famix-extensions-nav All Outgoing Invocations' .
'*famix-extensions-nav Inheritance' .
'*famix-extensions-Invocations' .
'*famix-extensions-cook-SureIncomingInvocations' .
'*famix-extensions-nav Sure Incoming Dependencies' .
'*famix-extensions-nav Static Accesses' .
'*famix-extensions-nav Sure Outgoing Invocations' .
'*Famix-Extensions-navigation' }


2- find all the methods in these protocols
cookSelector := (cookProtocols flatCollectAsSet: [:p | (Smalltalk allClasses gather: [:e | (e methodsInProtocol: p) collect: [:m | m selector]])]).
-> 191

these are the potential methods we want to replace by MooseChef queries


3- build a moose model with packages Moose-* and Famix-*

4- look for all FamixMethods with the name of a cookSelector (extracted above step 2)
cookSelectorInMoose := MooseModel root allModels first allMethods select: [:fm | cookSelector includes: fm name]
-> 344

5- find all invoking methods (ignoring the one in cookSelectorInMoose)
(cookSelectorInMoose flatCollectAsSet: [:m | m queryAllIncomingInvocations opposites]) reject: [:m | cookSelectorInMoose includes:  m]
-> 358


6- just for fun, check which of the cookSelector are actually called by these last ones
((invokingCook flatCollectAsSet: [:m | m queryAllOutgoingInvocations opposites]) select: [:m | cookSelectorInMoose includes: m]) collectAsSet: [:m | m name]
-> 141

so apparently 50 cookSelectors are never invoked outside of "Cook"


nicolas