Indeed, this situation could be improved, but I think the solution is different than what
you propose.
Currently, the exclusion of self loops happens at two levels:
1. withoutSelfLoops is result specific and it excludes the relationships based on the
input. So, something like
"aClass queryAllOutgoingDependencies withoutSelfLoops" will return all
dependencies that do not end in aClass
2. MooseQueryResult>>collectAtScope: rejects the results based on the scope
"aClass queryAllOutgoingDependencies atNamespaceScope" will return all target
namespaces involved in a dependency but that are not the namespace of the current class.
If you want to get the namespaces including the current one, you can play with the private
method "primCollectAtScope:":
"aClass queryOutgoingReferences primCollectAtScope: #namespaceScope"
All in all, the two ways of trimming are at different levels of abstraction.
So, I propose introducing methods like "atNamespaceScopeWithSelfLoops" or
"atNamespaceScopeWithoutSelfLoops". It is not so nice, but I do not see a clean
other solution.
I would probably prefer to have atNamespaceScope to return all namespaces, including self
loops, and introduce "atNamespaceScopeWithoutSelfLoops". What do you say?
Cheers,
Doru
On 28 Jul 2011, at 23:10, Nicolas Anquetil wrote:
I want to reimplement software engineering metrics
using moose chef instead of moose cook.
for example to compute cohesion I would do (among other things):
self queryAllOutgoingDependencies atClassScope withinMyPackage
i.e. :
1- from a package (self)
2- get all its "outgoingdependencies" (outgoing does not mean going outside the
package, this includes dependencies within th package)
3- put that at class level (because we are interested in dependencies between classes
within or outside the package)
4- and filter those that are inside self
I want the result to be all dependencies from classes within package self going to
classes within package self.
but (from the moose chef documentation):
"The scope operators exclude self loops by default (this was also the default in
Moose Cook). That is, the query result will not contain the receiver scope itself: you
will not get something like PackageX -> PackageX in the result (the reason for this is
that in general algorithms do not like graphs with self loops)."
So:
- should we change that default?
- should I change my query?
I believe if there is a method to exclude self loops (withoutSelfLoop), it should not be
done automatically in some case let those who want it do it themselves.
What say you?
nicolas
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
www.tudorgirba.com
"To lead is not to demand things, it is to make them happen."