5. Many tools leverage static analysis to detect architectural smells.
Exploiting dynamic analysis for architectural smell detection: a preliminary study
5
Tool Supported Languages Detected Architectural Smells
AI Reviewer C, C++
Cyclic Dependency, Hub-Like
Dependency, Cyclic Hierarchy, God
Component, Ambiguous Interface,
Unutilized Abstraction
ARCADE Java
Cyclic Dependency, Hub-Like
Dependency, Implicit Cross-module
Dependency
Arcan Java
Cyclic Dependency, Hub-Like
Dependency, Unstable Dependency,
Scattered Functionality, God Component,
Implicit Cross-module Dependency,
Architecture Violation
Designite C#
Cyclic Dependency, Hub-Like
Dependency, Unstable Dependency,
Cyclic Hierarchy, Scattered Functionality,
God Component, Multipath Hierarchy,
Ambiguous Interface, Unutilized
Abstraction, many others
Hotspot Detector Java
Cyclic Dependency, Unstable
Dependency, Cyclic Hierarchy,
Abstraction without Decoupling, Implicit
Cross-module Dependency
Massey Architecture Explorer Java
Cyclic Dependency, Cyclic Hierarchy,
Abstraction without Decoupling, Multipath
Hierarchy
Sonargraph Java, C#, C, C++ Cyclic Dependency, Architecture Violation
STAN Java Cyclic Dependency
Structure 101 Java, C#, C, C++, many other Cyclic Dependency, Architecture Violation
6. Hub-Like Dependency (HLD) a.k.a. Hub-like Modularization and Link Overload.
What does it? It occurs when an abstraction or a concrete class has (out-going and
in-going) dependencies with many
ot
her abstractions or concrete classes. It violates
Modularity and Healthy Dependency Structure.
How to detect it? The dependencies can be computed using several metri
cs
(e.g.,
Fan-In and Fan-Out for in-going and out-going dependencies). It requires selecting a
threshold. The detection results largely vary across tools.
Exploiting dynamic analysis for architectural smell detection: a preliminary study
6
Most Wanted #1: Hub-Like Dependency
7. Exploiting dynamic analysis for architectural smell detection: a preliminary study
7
Cyclic Dependency (CD) a.k.a. Tangle, Cross-Module Cycle, Cross-Package
Cycle, Cycle of classes, and Cyclically-dependent Modularization.
What does it? It arises when several architectural components depend on each
ot
her
directly or indirectly. It violates Modularity and Healthy Dependency Structure.
How to detect it? Most tools detect this smell only at the class level, then analyze it at
the package level by generalizing the dependency graph obtained at the class level.
Most Wanted #2: Cyclic Dependency
15. Exploiting dynamic analysis for architectural smell detection: a preliminary study
ARCAN: ARChitecture ANalyzer - https://essere.disco.unimib.it/wiki/arcan/
Detection Strategy for Hub-Like Dependency 12
Hub-Like Dependency (HLD) a.k.a. Hub-like Modularization and Link Overload.
What does it? It occurs when an abstraction or a concrete class has (out-going
and in-going) dependencies with many
ot
her abstractions or concrete classes. It
violates Modularity and Healthy Dependency Structure.
How to detect it? The dependencies can be computed using several metri
cs
(e.g., Fan-In and Fan-Out for in-going and out-going dependencies). It requires
selecting a threshold. The detection results largely vary across tools.
Metric Collection
Threshold Derivation via Static Analysis:
the median number of in-going and out-
going dependencies for each class.
Threshold Re
fi
nement: the maximum values of the two sets of thresholds.
If the “static” threshold equals zero, the re
fi
ned threshold is set to zero to decrease the
number of false positives.
Threshold Derivation via Dynamic Analysis:
the median number of in-going and out-
going dependencies for each class.
Architectural Smell Detection: evaluation of all components against the thresholds.
The classes whose metric values are higher than the thresholds are marked as smelly.
17. Exploiting dynamic analysis for architectural smell detection: a preliminary study
More about the Experimental Design
14
Project Version # Classes LOC % Coverage
JGraphT 0.8.1 38 11,931 73.8
JFreeChart 1.5.0 652 92,938 71.7
Apache Sling 1.6.17 83 10,312 65.8
Spring PetClinic 4.2.6 42 10,343 83.1
Lecousin.net 0.8.4 73 6,115 87.2
SimpleMathBackEnd 0.0.1 17 671 89.0
Zxing 3.4.1 499 43,623 98.0
Oryx 1.0.1 431 20,173 100.0
Ambari 1.2.3 711 70,621 100.0
HandleBar 4.2.0 391 24,770 78.0
The
fi
rst two authors of the paper validated each instance of
detected smell into True Positives and False Positives.
The validation was conducted in isolation to avoid bias.
We executed Arcan featuring (i) only static analysis and
(ii) both static and dynamic analysis
to detect Hub-Like Dependencies and Cyclic Dependencies.
21. Exploiting dynamic analysis for architectural smell detection: a preliminary study
Results for Hub-Like Dependency
18
A GUI Listener was detected as a Hub-Like Dependency.
Project
Static Analysis
(precision)
Static and Dynamic
Analysis
(precision)
# Matches
JFreeChart 2 (1.00) 14 (0.92) 2 (14%)
Apache Sling 3 (1.00) 5 (0.80) 3 (60%)
Spring PetClinic 0 (-) 1 (0.00) -
Lecousin.net 1 (1.00) 1 (1.00) 1 (100%)
HandleBar 2 (1.00) 7 (1.00) 1 (14%)
A Façade was detected as a Hub-Like Dependency.
The tests were not complete enough.
22. Exploiting dynamic analysis for architectural smell detection: a preliminary study
Results for Hub-Like Dependency
18
A GUI Listener was detected as a Hub-Like Dependency.
Project
Static Analysis
(precision)
Static and Dynamic
Analysis
(precision)
# Matches
JFreeChart 2 (1.00) 14 (0.92) 2 (14%)
Apache Sling 3 (1.00) 5 (0.80) 3 (60%)
Spring PetClinic 0 (-) 1 (0.00) -
Lecousin.net 1 (1.00) 1 (1.00) 1 (100%)
HandleBar 2 (1.00) 7 (1.00) 1 (14%)
A Façade was detected as a Hub-Like Dependency.
The tests were not complete enough.
Reminder 1. Utility classes may be naturally born
Hub-Like Dependencies.
23. Exploiting dynamic analysis for architectural smell detection: a preliminary study
Results for Hub-Like Dependency
18
A GUI Listener was detected as a Hub-Like Dependency.
Project
Static Analysis
(precision)
Static and Dynamic
Analysis
(precision)
# Matches
JFreeChart 2 (1.00) 14 (0.92) 2 (14%)
Apache Sling 3 (1.00) 5 (0.80) 3 (60%)
Spring PetClinic 0 (-) 1 (0.00) -
Lecousin.net 1 (1.00) 1 (1.00) 1 (100%)
HandleBar 2 (1.00) 7 (1.00) 1 (14%)
A Façade was detected as a Hub-Like Dependency.
The tests were not complete enough.
Reminder 1. Utility classes may be naturally born
Hub-Like Dependencies.
Reminder 2. Some Architectural Smells are related
to design patterns.
30. Exploiting dynamic analysis for architectural smell detection: a preliminary study
Limitations and Future Work
21
An excessive number of tests leads to very long execution traces, which are complex and costly to analyze.
What about the automated selection and generation of tests for dynamic analysis?
What about using execution traces from production (e.g., in a DevOps lifecycle)?
We considered only two architectural smells.
What about other architectural smells affecting other violations?
We relied on Java Call Tracer.
What about a dedicated monitoring component?