Main
Main
implementations
Johann Mortara, Philippe Collet, Anne-Marie Dery-Pinna
Crown =
level variability metrics (method variants for the height and con-
design pattern Entry point structor variants for the width), exhibiting variability concentration
classes
at method level inside a class. As for design patterns, they usually
involve several classes, but only the identified vp is highlighted in
the visualization through a specific crown on the building.
Hotspot and
VP / variant
The streets in the city shape it according to the usage relation-
Hotspot ships, starting from entry point classes, representing interesting
Methods points to explore the systems. These classes are positioned on a red
overloads
street and other streets represent usage relationships. Buildings are
Root street
placed by decreasing order of width on both sides of the street to
Constructors
exhibit density between classes. Additional usage relationships are
Usage link
overloads represented as underground streets, and inheritance relationships
as aerial links, both displayed when hovering a building. To make
the hotspot zones of variability detected by symfinder (see previous
section) noticeable, they are displayed in color (vp-s in yellow and
variants in blue).
The visualization is itself configurable through several parame-
Figure 1: Main visual properties of VariCity, taken from [6]. ters, the first one being the entry point classes, more entry points
tends to generate a larger city to explore. The classes displayed
are also dependent on the usage orientation (IN to include only
2 IDENTIFYING OO VARIABILITY classes using the entry points, OUT for the reverse usage, IN/OUT
IMPLEMENTATIONS for both ways) and the usage level (the number of hops from the
In variability-rich OO systems, the mechanisms used to implement entry points over the usage links).
variability in a single code base , namely inheritance, overloading,
and design patterns, do not align well with domain features, making 3.2 Limitations
their identification difficult. When these mechanisms are used to The visualization provided by VariCity shows multiple improve-
implement some variability, they also exhibit a property of symme- ments compared to the graph visualization of symfinder-2. Using a
try [2, 15] since the commonality and variability addressed by the navigable 3D representation of a city where the buildings exhibit
mechanism also represent the unchangeable and changeable parts the different variability metrics and are grouped by usage allows to
in code assets. For example, inheritance allows us to factorize com- better grasp the organization of the classes [6]. Inheritance and ad-
mon parts (unchangeable) of multiple subclasses (the changeable ditional usage relationships are displayed on hover not to overload
parts) into a superclass. the visualization. However, it still exhibits limitations to be used in
As the unchanged and changed parts can be abstracted in terms practice on very large systems.
of variation points (vp-s) with variants [12], a symmetry-based Firstly, variability implementations hamper the quality of a sys-
identification approach has been previously proposed [15] and tem and potentially create variability debt [18], especially since
tooled with the the symfinder toolchain [8]. The approach also OO variability implementations have no dedicated mechanism and
relies on the notion of density of symmetries in the code to reveal are therefore hidden in the codebase. With VariCity, understand-
the variability organization (i.e., vp-s with an important number of ing this debt would require to use additional tools extracting and
variants at class or method level) [13] and display it in the shape visualizing quality metrics (such as SonarQube2 that embeds the
of a graph. To fix the lack of precision of this first approach in CodeCity [17] and Evo-Streets [11] visualizations) on the side and
symfinder [13], the usage relationships (type used as an attribute or manually map those two sources of information. As these cities are
method parameter) has been taken into account with the definition shaped differently (the classic ones being shaped through package
of a parameterized density measure that enables to automatically decomposition), the simultaneous usage of VariCity and one of
reveal fewer but more relevant hotspot zones concentrating variabil- these visualizations would be cumbersome, especially when experi-
ity implementations [9]. However, the resulting symfinder’s graph menting with multiple metrics.
visualization is then harder to interpret on large systems with two Secondly, VariCity is configured relying on knowledge from the
types of relationships being displayed at the same time. codebase (e.g., names of the entrypoint classes). Developers usu-
ally rely on an Integrated Development Environment (IDE) as tool
3 A CITY-BASED VISUALIZATION support for assisting development and program comprehension
activities [5]. Therefore, a user would need to manually input infor-
3.1 VariCity
mation from their IDE in VariCity and then go back to it to explore
The city metaphor [16] has been applied to multiple types of met- the classes exhibited by the visualization, implying important con-
rics on software systems. In particular, CodeCity [17] and Evo- text switching. According to these limitations, we advocate that
Streets [11] rely on the city metaphor to represent quality metrics VariCity’s usability would be improved by (i) displaying quality
on classes of an OO system. VariCity adapts the city metaphor to metrics and (ii) being embedded into an IDE.
exhibit density of variability implementations [6] (cf. fig. 1). Classes
are buildings whose dimensions evolve according to their method 2 https://www.sonarqube.org/
IDE-assisted visualization of indebted OO variability implementations SPLC ’22, September 12–16, 2022, Graz, Austria
Figure 2: VariMetrics-IDE visualization of JFreeChart. The white and violet boxes have been manually added on the figure.
4 VISUALIZING QUALITY METRICS IN refactoring of the indebted zones detected by VariMetrics. An exam-
VARIMETRICS-IDE ple of exhibited classes is visible on fig. 2, where the two classes in
the white dotted box, CategoryPlot and XYPlot, exhibit multiple
As OO quality metrics are usually individual measures on the
method overloads (due to their height) and little test coverage (due
classes, we have to determine how to improve the VariCity vi-
to their cracks). Refactoring those classes led to an improvement of
sualization. VariCity displays in yellow vp-s being hotspots, in blue
those classes and the project’s overall quality [7]. More details on
variants being hotspots, and in grey classes not being hotspots
this evaluation are available on VariMetrics webpage3 .
(fig. 1). However classic quality-centric cities, such as CodeCity and
Evo-Streets, simply color the buildings to expose properties inher-
ent to the classes [10, 17]. In VariMetrics, three display strategies are
5 SEAMLESS NAVIGATION WITH THE CODE
thus introduced to handle quality metrics. First, buildings can be Although VariMetrics-IDE can be used as a standalone application
colored following a red-to-green sequence (fade). Second, a satura- in a web browser, an integration is provided for the popular IDE
tion can be applied for keeping the original colors of the buildings JetBrains IntelliJ IDEA4 . As the goal of this integration is to min-
and lightening or darkening them (intensity). Finally, a crackled imize the interactions out of the development environment, the
texture (cracks) can be applied over the building with different levels integration embeds all the interactions needed to configure and use
of cracks, allowing to combine metrics on a single view. VariMetrics-IDE. As shown on fig. 2, the visualization is embedded
Since there is no single definition of quality and each user might in a panel in the IDE window and provides controls over symfinder
be interested in different metrics, VariMetrics-IDE allows to con- and VariMetrics-IDE (see violet boxes in fig. 2). It also allows the
figure the view. The user can select and combine the desired qual- execution of the whole toolchain as detailed in section 4 from the
ity metrics on the different visual axes to visualize them simul- editor’s window.
taneously. Combining adequate metrics allows to exhibit critical Additionally, bidirectional navigation between the visualization
classes concentrating variability implementations. Relying on work and the code is provided to ease transitioning between the code
from Wolfart et al. [18], it results that OO systems implementing and its visual representation. On one side, it is possible to select
their variability in a single codebase are prone to exhibit variabil- multiple buildings in the visualization and to open their sources
ity debt as code duplication, lack of tests, and increased cognitive as tabs in the IDE. On the other side, IntelliJ’s context menu has
complexity. been enriched, and right-clicking on a class in the Project sidebar
The VariMetrics visualization has been quantitatively evaluated or on the name of the class in the editor panel proposes a Focus
on seven industrial open-source projects from several thousands to on This Class button, zooming the visualization on the desired
2.4MLoC. Using these metrics, the exhibited classes were both criti- class, and another entry to add or remove a class from the entry
cal and concentrating variability implementations [7]. A qualitative 3 https://deathstar3.github.io/varimetrics-demo/
evaluation was also conducted on the JFreeChart project, with the 4 https://www.jetbrains.com/idea/
SPLC ’22, September 12–16, 2022, Graz, Austria Johann Mortara, Philippe Collet, and Anne-Marie Pinna-Dery