MooseChef is a new package which provides a small DSL to query (some of the) dependencies
between famix entities. It is a replacement for the current Moose Cook project, which
provides 'navigation methods' between famix entities and resides in the
Famix-Extensions package.
Basically, MooseChef provides an API with a few methods to ask a method, a class, a
package, a namespace for its dependencies (invocations, inheritance, references...) to
other entities at various scope (class, package, namespace). Moose Chef comes as a small
set of composable queries, with a well defined meaning, which is easy to browse and
understand, and reused across Famix entities through traits.
*** Source, side, and dependencies
To start with, a query has a source (or receiver), that is the famix entity for which we
require dependencies. Currently FamixMethod, FamixClass, FamixPackage, and FamixNamepace
supports Chef queries. Relative to the source, a query has a side: it can be a query on
either incoming or outgoing dependencies. Primitive queries returns a set of dependencies
related to the source, that is instances of FamixAssociation: invocations, accesses,
inheritances, references.
*** Primitive queries to access dependencies as associations
Hence, the combination of sides and dependencies define the set of primitive queries
availble for any source.
source
query[Incoming|Outgoing][Invocations|SureInvocations|Accesses|References|Inheritances].
You can ask for example
aFamixMethod queryIncomingInvocations
but also
aFamixClass queryIncomingInvocations
aFamixPackage queryIncomingInvocations
(Notice that a few queries do not make sense for some receiver, like for example asking a
FamixMethod for its inheritances or it incoming references - in this case the convention
is to return the neutral value, that is an empty collection).
Some 'composite' queries are also defined on top: all dependencies, sure
dependencies,
static dependencies : accesses + references + inheritances
sure dependencies : static + sure invocations
all dependencies : static + invocations
--
Simon Denier