CSC/ECE 517 Fall 2009/wiki3 2 clone: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 31: Line 31:
== Clone Detection Tools ==
== Clone Detection Tools ==
<b>1. Duploc:</b> This language independent tool helps in clone detection.  It offers clicakble matrix display that helps developers to locate the source code snippet that is cloned.  This tool includes an information mural algorithm, and it helps the tool to show a matrix of 100,000 lines lines per side in its entirety on  a 600x800 screen[2].
<b>1. Duploc:</b> This language independent tool helps in clone detection.  It offers clicakble matrix display that helps developers to locate the source code snippet that is cloned.  This tool includes an information mural algorithm, and it helps the tool to show a matrix of 100,000 lines lines per side in its entirety on  a 600x800 screen[2].
<br>2. Moss:  
<br><b>2. Moss:</b>
<br>3. JPlag:  
<br><b>3. JPlag:</b>
<br>4. Dup:  
<br><b>4. Dup:</b>
<br>5. Dotplot:
<br><b>5. Dotplot:</b>
<br>6. Covet:  
<br><b>6. Covet:</b>
<br>7. CloneDR:  
<br><b>7. CloneDR:</b>
<br>8. CLAN:
<br><b>8. CLAN:</b>


== Comparing With Refactoring ==
== Comparing With Refactoring ==

Revision as of 05:17, 18 November 2009

Clone Detection and Clone Manipulation

Clone Detection

"Software clones are segments of code that are similar according to some definition of similarity" —Ira Baxter, 2002[1]. As per this definition, two code snippets may be similar based on text, syntactic structure or semantics or if they follow same pattern. Two code fragments are similar if their program text is similar. Code snippets may not be semantically equivalent. Such code snippets are also termed as redundant because if one changes then the other also needs to be changed. However, some clones cannot be replaced by another for example, two code snippets may be identical at the textual level but they refer to different variables declared in different places with the same name. Example of such clones is shown below:

Example of such clones is shown below:

 int count = 0;
 int methodA(string str)
 {
       for (int i=0;i<str.length;i++)
       {
          count = count + 1;
       }
 }
 int methodB(string str)
 {
       int count=0;
       for (int i=0;i<str.length;i++)
       {
 	  count = count + 1;
       }
 }

In the above code snippet, count in methodA refers to global variable whereas in methodB it refers to local count variable.

Clone Manipulation

Clone Detection Tools

1. Duploc: This language independent tool helps in clone detection. It offers clicakble matrix display that helps developers to locate the source code snippet that is cloned. This tool includes an information mural algorithm, and it helps the tool to show a matrix of 100,000 lines lines per side in its entirety on a 600x800 screen[2].
2. Moss:
3. JPlag:
4. Dup:
5. Dotplot:
6. Covet:
7. CloneDR:
8. CLAN:

Comparing With Refactoring

Conclusion

See Also

References

1. http://drops.dagstuhl.de/opus/volltexte/2007/962/pdf/06301.KoschkeRainer.962.pdf
2. http://scg.unibe.ch/archive/papers/Duca99bCodeDuplication.pdf