0% found this document useful (0 votes)
25 views24 pages

Seminar On: Clone Management For Evolving Softwares

Code clones are duplicated sections of code that increase maintenance costs. Programmers often unintentionally create clones when copying and pasting code. Clones can evolve over time as programmers apply similar changes. Researchers have developed techniques to detect, analyze, and refactor clones using string matching, token parsing, and graph matching. Future work includes improving detection precision and automation to help programmers manage clones.

Uploaded by

Gaurav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views24 pages

Seminar On: Clone Management For Evolving Softwares

Code clones are duplicated sections of code that increase maintenance costs. Programmers often unintentionally create clones when copying and pasting code. Clones can evolve over time as programmers apply similar changes. Researchers have developed techniques to detect, analyze, and refactor clones using string matching, token parsing, and graph matching. Future work includes improving detection precision and automation to help programmers manage clones.

Uploaded by

Gaurav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 24

Seminar on

Clone Management For


Evolving Softwares
Definition….

Maintenance is the most costly phase of the


software lifecycle

Code Clone: gratuitous copy of source code in a


program.

Code Clones have the effect of increasing source


code size and duplication of errors
A Study of Copy and Paste
Programming
Even skilled programmers often create and manage code clones
with clear intent.
programmers cannot refactor clones because of programming
language limitations.

programmers often apply similar changes to clones.

programmers keep and maintain clones until they realize how


to abstract the common part of clones.
Model of Clone Evolution
Location overlapping
relationship

Cloning relationship
C
C C
Code snippet
D D D D
A A A A A
B B B B
Clone group
Version i Version i+1 Version i+2 Version i+3 Version i+4

Add Consistent Change Inconsistent Change Subtract

Evolution Patterns
Clone genealogy reflects how programmers evolved
code clones by copying, pasting and modifying code.
consistently
changed

C C
D D D D
A A A A A
B B B B

E E E E
copied, F F F F
pasted,
and modified G
Potential Tool: Warning Cloning
Related Bug consistently
changed

C C
D D D D
A A A A A
B B B B

E E E E
copied, F F F F
pasted,
and modified G
CODE CLONE

TYPE TYPE
1 4

TYPE TYPE
2 3
CLONE :AREAS OF RESEARCH
CLONE CHANGE PATTERNS
GENEALOGY
PROCESS OF CHANGE
MANAGEMENT SYSTEM
CHECK SOURCE
COMMIT SOURCE CODE CODE

VERSION
CONTROL
SYSTEM

DEVELOPERS
CHANGE MANAGEMENT
(USERS) SYSTEM
PROVIDE CHANGED
INFORMATION OF CODE CLONES
AND CLONE SETS
Detection
String Matching – Represents and evaluates code
using string comparisons.

Token Parsing – Code transformation into tokens for


comparison.

Graph Matching – Pattern matching on graph


representations of code.
Detection Strategies
String Matching Techniques

Exact String Matching

Parameterized Matching

Substring Matching
Token Parsing Techniques
Transforms code into tokens by using
language specific constructs into a single
token string

Find similarities within this token string

Transform token clones back into code


clones for presentation
Graph Matching Techniques

Form machine
representation
of code
Identify
clones as
identical
subgraphs
Code Clone Refactoring

Use standard Refactoring methods


“Extract” - Make a procedure
“Pull Up” - Make an superclass
Aspect Oriented Programming
Advanced technique for clones that are too
tough for procedural or OO solutions
Extract
Pull Up
Worst-Case
branches are ordered so that no pruning takes place
alpha-beta gives no improvement over exhaustive search

Best-Case
each player’s best move is the left-most alternative (i.e., evaluated
first)

In practice often get O(b(d/2)) rather than O(bd)


e.g., in chess go from b ~ 35 to b ~ 6
• this permits much deeper search in the same amount of time
• makes computer chess competitive with humans!
Conclusion
Alternative techniques detect different clone types.

Code clone detection and removal is still in its


infancy.

Code clone refactoring tools should be incorporated


into standard IDEs to achieve widespread adoption.
Future Research
Detector improvement
Improve precision and refactorability of
token based detectors
Performance of graph based detectors
AI-based detectors?
Comparison of detection methods
Future Research

Continue study of code clones


Effects of Agile methodologies
Impact on Web-based code
Visualization of clones
Automated refactoring systems
References
1. E. Adar and M. Kim. SoftGUESS: Visualization and exploration of
code clones in context. In CHI, pages 791–800,ACM, 2006.
2. G. Antoniol, G. Casazza, M. Di Penta, and E. Merlo. Modeling
clones evolution through time, In ICSE, pages 762 –766, 2007.
3. M. Asaduzzaman. Visualization and analysis of software clones.
M.Sc. thesis, University of Saskatchewan, Canada, 2011.
Thank you……

You might also like