2019 IEEE/ACM 27th International Conference on Program Comprehension (ICPC)

CCEvovis: A Clone Evolution Visualization System
for Software Maintenance
Hirotaka Honda∗ , Shogo Tokui∗ , Kazuki Yokoi∗ , Eunjong Choi‡ , Norihiro Yoshida† , and Katsuro Inoue∗∗ Osaka University, Japan, {h-honda, s-tokui, k-yokoi, inoue}@ist.osaka-u.ac.jp‡ Nara Institute of Science and Technology, Japan, choi@is.naist.jp† Nagoya University, Japan, yoshida@ertl.jp

to support code clone maintenance. CCEvovis detects code
clones across multiple versions of a program and provides andvisualizes and highlights the evolution of code clones basedon their evolution patterns.

Abstract—Understanding the evolution of code clones is important in software maintenance. With the information about
how code clones evolve, both developers and researchers canunderstand the impacts of code clones and build a more robust
code clone management system. So far, many studies haveinvestigated the evolution of code clones to better understandthe effects of code clones. However, only a few systems havebeen presented to support managing code clones based on theinformation about how code clone evolves. To mitigate thisproblem, in this paper, we present CCEvovis, a system thatvisualizes the evolved code clones across multiple versions of aprogram. CCEvovis highlights and visualizes the clone change
to support software maintenance. CCEvovis is available at:https://github.com/hirotaka0616/CCEvovis.
Index Terms—code clone, software maintenance, visualization

II. CCE VOVIS
CCEvovis is a system that visualizes the evolved code
clones across multiple versions of a program to support
maintenance of code clones. Fig. 1 shows the architecture
overview of CCEvovis for two versions of a program. As canbe seen in this ﬁgure, CCEvovis is comprised of the following
four steps: (1) Detect Clones, (2) Map Clones, (3) Categorize
Clone Sets, and (4) Visualize the Clone Evolution.
A. Detect Clones

I. I NTRODUCTIONAt ﬁrst, CCEvovis detects code clones Ci and Ci+i fromtwo given consecutive versions vi and vi+i of a program.
Note that each version can be also directly extracted from
Github repository. To detect code clones, CCEvovis allows auser to choose a code clone detection tool among following
representative code clone detection tools.
• Vector-based clone detection tool [4]: a lightweight toolfor detecting function clones using information retrieval
techniques• CCVolti [5]: a code clone detection tool that detects
block-level code clones
1• CCFinderX : a token-based code clone tool that detects
syntactically similar code clones• SourcererCC [6]: a token-based code clone detection
tool for very large scale source code

Code clones, duplicated code, are created by copying andpasting existing code with/without modiﬁcations. Most of thesoftware contains a signiﬁcant amount of code clones. They
cause additional effort in comprehending and maintaining asystem.
Several recent systems for the management and visualization of code clones do exist to support maintenance of code
clones [1]. By using these systems, developers can effectively
apply consistent modiﬁcations to a clone set (i.e., a set ofcode clones that are identical or similar to each other) or ﬁnd
candidates for clone refactoring (i.e, merging code clones intoa single unit) [2]. In the past, our research group developed
a code clone management system called Clone Notiﬁer [3],which reports creation and change of code clones between
two consecutive versions. We also conﬁrmed that a developer
successfully identiﬁed ten candidates for clone refactoring byusing Clone Notiﬁer. However, it has a limitation in that it
only provides change information of code clones between two
versions. Understanding the evolution of code clones are important for maintenance of code clones. With the information
about how code clones evolve, developers can understand theimpacts of code clones and manage them accordingly. However, because Clone Notiﬁer provides change information ofcode clones between two versions, developers might overlook
important information for managing code clones in the context
of clone evolution.
To mitigate this problem, in this paper, we present CCEvovis, a system for visualizing the evolution of code clones
978-1-7281-1519-1/19/$31.00 ©2019 IEEE
DOI 10.1109/ICPC.2019.00026

B. Map Clones
To map detected code clones Ci and Ci+i between two
versions, CCEvovis uses the same method with the Clone
Notiﬁer. That is, it maps code clones based on correspondenceof the start and end line of them in source code between
versions. It also uses the parent-child relationship to code
clones between two versions to map code clones. Let acode clone ci ∈ Ci is detected in a version vi and a code
clone ci+1 ∈ Ci+1 is detected in a version vi+1 in the twoconsecutive versions vi and vi+1 . Moreover, three lines were
newly inserted to code clone ci+1 between two versions. In
1 http://www.ccﬁnder.net/ccﬁnderx-j.html

122Visualize the Clone Evolution

DetectClonesVi

Ci

DetectClonesCategorize
Clone Sets

Map
ClonesCi

Ci+1
Stacked Bar Graph

Mapped Clones

Vi+1

Clone Set List

Source Code

Ci+1

Fig. 1: An architecture overview of CCEvovis

this case, ci and ci+1 are mapped by counting and insertedlines in ci+1 . Thus, the start line number of ci+1 is the sameas ci , and the end line number of ci+1 is increased by threelines. In the the parent-child relationship, a child clone of ci
is ci+1 and a parent clone of ci+1 is ci .

First, a user can intuitively grasp the size, ratio, and tendencyof each clone set. Second, he/she is able to easily compare
each clone set across multiple versions.
An example of the Stacked Bar Graph page is shown in
Fig.2 (a). As can be seen from this ﬁgure, the horizontal axisof the Stacked Bar Graph shows each date of the version. The
vertical axis of the Stacked Bar Graph presents the numberof each clone sets in the different categories. That is, Newclone set is shown with a red bar, Changed clone set is shownwith a green bar, and Deleted clone sets is shown with a dark
blue bar. The height of the Stacked Bar Graph corresponds tothe sum of the number of New, Changed, and Deleted clone
sets. Meanwhile, CCEvovis does not provide the information
on Stable clone sets in the Stacked Bar Graph page. There
are two reasons for this: ﬁrst, the need for providing theinformation of the Stable clone set is low. Generally, the Stableclone sets are not considered as a target for the management.
The second, it avoids unnecessary effort for distinguishing theimportant information to manage code clones in a short-term
analysis. We assume that most of the users adopt CCEvovis toanalysis the evolution of code clones within a relatively shorttime period such as a day or week. In this case, most code
clones are not changed [7]. Therefore, most of the clone setsmight be classiﬁed as Stable clone sets. If Stacked Bar Graph
page provides information on Stable clone sets, it is difﬁcult
for a user to acquire important information for managing
code clones such as New, Changed, and Deleted clone sets.
By clicking a Stacked Bar Graph, a user can move to thecorresponding Clone Set List page.
Clone Set List page: The goal of the Clone Set List page isto present a list of clone sets in different categories (i.e., New,
Changed, Deleted, and Stable clone sets) between two selectedversions. Note that this page provides a list of Stable clone
sets because a user might want to conﬁrm the list of Stableclone sets for his/her task. These clone sets are displayed withthe following order: New, Changed, Deleted, and Stable clone
sets. In this page, new clone sets are displayed ﬁrst, because we
assume that these clone sets should be preferentially managed.
An example of the Clone Set List page is shown in Fig.2 (b).
As can be seen in this ﬁgure, the Clone Set List page displays
each clone set with a list of code clones that are belonging tothis clone set. This page also shows the assigned ID, evolution
pattern, the name ﬁle where the code clone is located, and theposition of the code clone in the ﬁle are displayed for each

C. Categorize Clone Sets
All clone sets are categorized based on change patterns ofthem between two versions vi and vi+1 of a program. To
classify clone sets, CCEvovis also uses the same categories
that were used in the Clone Notiﬁer.
• Stable clone set: Stable clone set contains code clone ci+1that satisﬁes the following conditions: (1) parent clone of
ci+1 exists in vi and (2) ci+1 is unmodiﬁed until vi+1 .
These clone sets contain clones that involved in vi andvi+1 respectively.
• New clone set: New clone set contains code clones ci+1
whose parent clones do not exist in vi . These clone sets
involved in only vi+1 .
• Deleted clone set: Deleted clone set contains clones ci
whose child clones do not exist in vi+1 . These clone sets
involved in only vi .
• Changed clone set: Changed clone set contain a code
clone that satisﬁes one of the following conditions: (1)parent clone of ci+1 exists in vi and ci+1 is unmodiﬁed
until vi+1 , (2) code clones ci+1 whose parent clones do
not exist in vi , and (3) clones ci whose child clones
do not exist in vi+1 These clone sets contain changed,
deleted and newly added clones that involved in vi andvi+1 respectively.
D. Visualize the Clone Evolution
Visualization of the clone evolution may be an effective aid
to clone management. To support the maintenance of code
clones, CCEvovis provides and visualizes different information of the clone evolution with three pages: 1) Stacked Bar
Graph page, 2) Clone Set List page, and 3) Source Codepage. Fig.2 depicts the visualization of the clone evolutionof PostgreSQL2 from these three pages.
Stacked Bar Graph page: The goal of the Stacked Bar
Graph page is to visualize the evolution of the clone sets
in different categories, explained in Section II-C. There are
two advantages of using the Stacked Bar Graph in CCEvovis.
2 https://www.postgresql.org/

123

(a) An example of Stacked Bar Graph pageFig. 3: An overview of the Stacked Bar Graph pageshown in Fig.2 (c). In this page, the source code of each code
clone is highlighted with the yellow background color. ”+”
indicates an added line in the new version, and ”-” indicatesa deleted line in the new version.
III. I LLUSTRATIVE USAGE SCENARIO
In this section, we demonstrate the usage of CCEvovis forvisualizing the evolution of code clones to support the maintenance of code clones. In particular, we provide illustrativeof a usage scenario with respect to the following code clone
maintenance tasks:
1) Identify targets for clone refactoring: One scenario forthe use of CCEvovis is that a user can identify targets
for clone refactoring. Generally, it is difﬁcult to identify
targets for clone refactoring among detected code clones.
2) Conﬁrm refactored code: Another group of tasks is that
conﬁrming the refactored code clones. It is important fordevelopers to conﬁrm the refactored code clones becauseinconsistent changes to code clones introduce software
defects.
To accomplish these tasks, the developer uses CCEvovis with the ten versions of the Apache Tomcat3 , an open
source implementation of the Java Servlet, JavaServer Pages,
Java Expression Language, and Java WebSocket technologies.
The code clones were analyzed within the time-frame from
September 8, 2018, to November 10, 2018, with a oneweek interval. To detect code clones from these versions, thedeveloper selects SourcererCC as a code clone detection tool.
Fig.3 depicts the Stacked Bar Graph page of the Apache
Tomcat. From this ﬁgure, the developer can conﬁrm thefollowing:(A) A New clone set (shown in a red bar) appeared on
October 13, 2018
(B) A Deleted clone set (shown in a dark blue bar) appearedon November 10, 2018
With this information, the developer can identify a target
for clone refactoring. In order to refactor this clone set, the(b) An example of Clone Set List page(c) An example of Source Code pageFig. 2: Web UI for visualizing the clone evolution

code clone. A user can move the Source Code page by clicking
the source code icon.
Source Code page: The goal of the Source code page isto present source code of the code clones that are involved in
the selected clone set. An example of the Source Code page is

3 http://tomcat.apache.org/

124

13 Oct. 2018

10 Nov. 2018

java/org/apache/catalina/tribes/membership/cloud/CertificateStreamProvider.java

java/org/apache/catalina/tribes/membership/cloud/AbstractStreamProvider.java

100
101

113
114

120
121
122
123
124

private static TrustManager[] configureCaCert(String caCertFile) throws Exception {if (caCertFile != null) {

䠊
䠊
䠊

136
137
138
139
140

} else {log.warn(sm.getString("certificateStream.CACertUndefined"));return InsecureStreamProvider.INSECURE_TRUST_MANAGERS;}}

protected static TrustManager[] configureCaCert(String caCertFile) throws Exception {if (caCertFile != null) {䠊䠊䠊} else {log.warn(sm.getString("abstractStream.CACertUndefined"));return InsecureStreamProvider.INSECURE_TRUST_MANAGERS;}}

NEW clone set
Clone 1

Refactoring

Clone 284
85

private TrustManager[] configureCaCert(String caCertFile) throws Exception {if (caCertFile != null) {

112
113
114
115
116

} else {log.warn(sm.getString("tokenStream.CACertUndefined"));return InsecureStreamProvider.INSECURE_TRUST_MANAGERS;
}

䠊
䠊
䠊

}

java/org/apache/catalina/tribes/membership/cloud/TokenStreamProvider.java

Fig. 4: An example of the NEW code set
developer can determine whether or not refactor this clone set
by clicking the New clone set appeared on October 13, 2018,
and then conﬁrming details of each code clone contained inthis clone set and its source code in the Clone Set List andSource Code pages.
Moreover, the developer can conﬁrm refactored code byclicking the Deleted clone set that appeared on November 10,
2018. He/she can check the details of each clone contained in
the Deleted clone set and its source code in the Clone Set Listand Source Code pages. This means that the developer is able
to conﬁrm that the refactored clone sets with CCEvovis.
To better understand this phenomenon, we analyze thedetails of these clone sets and conﬁrm that the New clone set
appeared on October 13, 2018, was refactored on November
10, 2018. As a result, the New clone set appeared as theDeleted clone set on November 10, 2018. Fig.4 depicts thedetailed of information of these clone sets. In this ﬁgure,cloned methods named conﬁgureCaCert in the CertiﬁcateStreamProvider class and TokenStreamProvider class were
newly appeared in October 13, 2019 and then refactored in
November 10, 2018.
CCEvovis can provide information on the New clone set
to be refactored. In addition, the developer can conﬁrm thecompletion of refactoring of the New clone set with information on the Deleted clone set. These suggest that CCEvovis isable to support identifying a target for clone refactoring andconﬁrming the refactored clone.

a program and provides and visualizes and highlights theevolution of code clones based on their evolution patterns withthree main pages. CCEvovis supports the maintenance of code
clones. In particular, CCEvovis is able to support identifying
a target for clone refactoring and conﬁrming the refactored
clone.
As a part of future work, we plan to extend CCEvovis to
be integrated into the IDE for helping developers maintaincode clones in time. We are also interested in improving thevisualization of clone evolution by allowing developers to
hide/ﬁlter out certain clone categories of clone sets.
ACKNOWLEDGMENT
This work was supported by JSPS KAKENHI Grant Numbers JP25220003, JP18H04094 and JP16K16034.
R EFERENCES[1] C. K. Roy, M. F. Zibran, and R. Koschke, “The vision of software
clone management: Past, present, and future (keynote paper),” in Proc.
of CSMR-WCRE, 2014, pp. 18–33.
[2] M. Fowler, Refactoring: improving the design of existing code. AddisonWesley Professional, 2018.
[3] Y. Yamanaka, E. Choi, N. Yoshida, K. Inoue, and T. Sano, “Applying
clone change notiﬁcation system into an industrial development process,”
in Prof. ICPC, May 2013, pp. 199–206.
[4] Y. Yamanaka, E. Choi, N. Yoshida, and K. Inoue, “A high speed function
clone detection based on information retrieval technique,” IPSJ Journal,
vol. 55, no. 10, pp. 2245–2255, 2014, in Japanese.
[5] K. Yokoi, E. Choi, N. Yoshida, and K. Inoue, “Fine-grained blockclone detection based on information retrieval techniques,” JSSST journal
Computer Software, vol. 35, no. 4, pp. 16–36, 2018, in Japanese.
[6] H. Sajnani, V. Saini, J. Svajlenko, C. K. Roy, and C. V. Lopes, “SourcererCC: Scaling code clone detection to big–code,” in Proc. of ICSE, 2016,
pp. 1157–1168.
[7] J. Krinke, “Is Cloned Code more Stable than Non-cloned Code?” in Proc.
SCAM, 2008, pp. 57–66.

IV. C ONCLUSION AND F UTURE WORKThis paper presents CCEvovis, a system for visualizing theevolution of code clones to support code clone maintenance.
CCEvovis detects code clones across multiple versions of125