Title: Visualization of Clone Detection Results
1Visualization of Clone Detection Results
Eclipse Technology Exchange Workshop OOPSLA
2006 Portland, Oregon
Robert Tairas
with Jeff Gray and Ira Baxter
2Code Clones
- A sequence of statements that are duplicated in
multiple locations in a program
Source Code
ClonedCode
_____ _______ _________ ___ ______ ___ ______ ____
__ _____ ________ ___ _______________ ____ _____
__ ______ _________ _____ _______ ________ ___ __
_____________
_______ _____ _________ _______ ___ ______ _______
_ __________ _______ ____ _______ ________ ___ __
_____________ ____ ______ _________ _____ ____
________ ____
__________ _______ ___ ________ ___ ____________
___ _____ ________ ___ _______________ ______ ___
____ ______ _______ _________ _______ ___ _______
_ ___ _____________
________ ___ _______________
3Clones in Source Code
- Copy-and-paste parts of code from one location to
another - The copied code alreadyworks correctly
- No time to be efficient
- Research shows that5-10 of large scalecomputer
programsare clones (Baxter, 98)
Source Code
_____ _______ _________ ___ ______ ___ ______ ____
__ _____ ________ ___ _______________ ____ _____
__ ______ _________ _____ _______ ________ ___ __
_____________
_______ _____ _________ _______ ___ ______ _______
_ __________ _______ ____ _______ ________ ___ __
_____________ ____ ______ _________ _____ ____
________ ____
__________ _______ ___ ________ ___ ____________
___ _____ ________ ___ _______________ ______ ___
____ ______ _______ _________ _______ ___ _______
_ ___ _____________
4Supporting Tool CloneDR
- Commercial clone detection tool developed by
Semantic Designs - Finds clones by examining the abstract syntax
tree representation of a program - Java version freely available athttp//www.seman
ticdesigns.com/Products/Clone/register-download.ht
ml
5Supporting tool AJDT Visualiser Plugin
- Part of the AspectJ Development Tools (AJDT)
project - AJDT Visualiser website http//www.eclipse.org/aj
dt/visualiser - An extension point to pass information
Bars Implement IContentProvider Interface
Stripes Implement IMarkupProvider Interface
Visualiser View
6Clone Detection Results
7Process
Clone Detection Results Plugin
CloneDR
Detection Info View
Config Wizard
1
3
2
Detected Clones View
Results Text File Parser
3
3
Eclipse Platform
Detected Clones View
AJDT Visualiser Plugin
- Initially, user is assisted by detection process
configuration wizard. - CloneDR executes and generates a text file
containing its results. These results are parsed
by the plugin. - Detection statistics sent to information view and
detected clones sent to both textual and
graphical view (step 3).
8Configuration Wizard
- The detection of clones can run on all files or
just on pre-selected files - The detection settings for CloneDR are also set
in the wizard - Wizard generates a configuration file that will
be used by CloneDR
9Detection Information
- Statistical information about the clone detection
procedure itself in addition to the configuration
settings are displayed in the clone detection
results information view.
10List of Clones
- Clone information
- grouped by similarity
- source file
- starting line number
- ending line number
- Not new, Simian and SimScan plugins also provide
similar reporting
11Visualiser View
- Bars Source files
- Stripes (Kinds) Clones
- Mouse over
- Length of clone
- Other clones in the same clone group
12Visualiser View
- Additional Options
- Display all bars containing the same clones as in
the selected bar - Display all bars containing the selected clone
- Open the file containing the selected clone
- Open all files containing clones in the same
clone group as the selected clone
13The Big Picture
14Case Study
- Performed on open source applications
- JavaGenes, scientific evolutionary software
- JHotDraw, a GUI framework
- Understanding the results
- Clone group in the same class (JavaGenes)
15Case Study
- Understanding the results (continued)
- Ubitiquous clones (JHotDraw), methods that
- return a new Rectangle object
- draw two ovals (including setting their colors)
- setting the undo and redo flags for the drawing
view
16Future Work
- A more structured view of the source code files
- For OO languages, classes could be displayed in
UML-like form. - Demarcation of methods in bars representing
source files - Displaying the borders of methods in the view can
assist in determining which clones are
method-level clones. - Tighter integration of CloneDR in Eclipse
- Simplify and speed up the detection and
visualization process.
CloneDR
17Thank you. Questions?
- Visualization of Clone Detection Results
http//www.cis.uab.edu/tairasr/visual - Clone Detection Literature http//www.cis.uab.edu
/tairasr/clones/literature - SoftCom Laboratory http//www.cis.uab.edu/softcom