Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools

Smell Detectors and Metrics for Cultivate 0.3 Milestone 2

Metric detectors

Structure detectors evaluate certain structures and return a numeric value in a metric specific range for them, if they can be calculated (sometimes division by zero prevents calculation).

Test are contained in prolog-tests/org/cs3/cultivate/pl/metrics/

MetricGranularityDescriptionTest Case
abstractnesspackagenumber of abstract classes in category ÷ total number of classes in
afferent couplings (Ac)packagenumber of classes outside this package that depend upon classes within this
depth of inheritance treeclassnumber of steps up to Object in the inheritance
distance (normalized)packageDn = abs(Abstractness + Instability - 1)
efferent couplings (Ec)packagenumber of classes outside this package that classes within this package depend
instabilitypackageEc / (Ac + Ec) if Ac + Ec != 0
0 otherwise
lcom2classlack of cohesion of methods
(excluding all trivial getters)

1 - (NumberOfMethodsAccessingFields/(NumberOfMethods*NumberOfFields))
nocclassnumber of children (number of direct subclasses)
number of abstract classespackagenumber of abstract
number of classespackagenumber of classes, abstract classes and interfaces in a
number of descendantsclassnod = number of descendants (direct and indirect subclasses)
number of interfacespackagenumber of interfaces in a
number of overridden methodsclassnorm = number of overridden
sixclassspecialization index

static test coverageclasspercentage of public methods called by

Smell Detectors

Structure detectors detect structures that are bad smells.

Test are contained in prolog-tests/org/cs3/cultivate/pl/smells/

SmellGranularityDescriptionTest Case
no operation (nop)statementempty
misnamed testclassclasstest class that's name does not end with “Test”
sideeffects in gettersmethodgetters do more than calculate results and return them

proposal: categories no side effects, possible side effects, known side effects
for testers onlymethodfinds methods that are only used by
package circularitypackagefinds all strongly connected package components with more than one package in the package dependency graph

Structure Detectors

Structure detectors detect structures like inheritance or package dependencies. Their results are used in different diagrams.

Test are contained in prolog-tests/org/cs3/cultivate/pl/structures/

StructureGranularityDescriptionTest Case
class dependencyclasschecks whether on class depends on another or
package dependencypackage
inheritanceclasschecks if one class extends


Queries allow further investigation on certain PEFs from special views, sophisticated java analyzers etc.

Test are contained in prolog-tests/org/cs3/cultivate/pl/queries/

QueryGranularityDescriptionTest Case
full qualified name
research/cultivate/smelldetectorsandmetrics_v0_3m2.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019