ABSTRACT
Programmers often copy and paste code so that they can reuse the existing code to complete a similar task. Many times, modifications to the newly pasted code include renaming all instances of an identifier, such as a variable name, consistently throughout the fragment. When these modifications are done manually, undetected inconsistencies and errors can result in the code, for example, a single instance can be missed and mistakenly not renamed. To help programmers avoid making this type of copy-paste error, we created a tool, named CReN, to provide tracking and identifier renaming support within copy-and-paste clones in an integrated development environment (IDE). CReN tracks the code clones involved when copying and pasting occurs in the IDE and infers a set of rules based on the relationships between the identifiers in these code fragments. These rules capture the programmer's intentions, for example, that a particular group of identifiers should be renamed consistently together. Programmers can also provide feedback to improve the accuracy of the inferred rules by specifying that a particular instance of an identifier is to be renamed separately. We introduce our CReN tool, which is implemented as an Eclipse plug-in in Java.
- E. Duala-Ekoko and M. P. Robillard, "Tracking Code Clones in Evolving Software", ACM SIGSOFT-IEEE International Conference on Software Engineering (ICSE), 2007. Google ScholarDigital Library
- L. Jiang, Z. Su, and E. Chiu, "Context-Based Detection of Clone-Related Bugs", European Software Engineering Conference (ESEC) and ACM SIGSOFT International Symposium on the Foundations of Software Engineering (FSE), 2007. Google ScholarDigital Library
- Z. Li, S. Lu, S. Myagmar, and Y. Zhou, "CP-Miner: A Tool for Finding Copy-paste and Related Bugs in Operating System Code", USENIX-ACM SIGOPS Symposium on Operating Systems Design and Implementation (OSDI), 2004. Google ScholarDigital Library
- B. Liblit, A. Aiken, A. X. Zheng, and M. I. Jordan, "Bug Isolation via Remote Program Sampling", ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), 2003. Google ScholarDigital Library
- M. Toomim, A. Begel, and S. L. Graham, "Managing Duplicated Code with Linked Editing", IEEE Symposium on Visual Languages -- Human Centric Computing (VLHCC), 2004. Google ScholarDigital Library
Index Terms
- CReN: a tool for tracking copy-and-paste code clones and renaming identifiers consistently in the IDE
Recommendations
Managing the copy-and-paste programming practice in modern IDEs
OOPSLA '07: Companion to the 22nd ACM SIGPLAN conference on Object-oriented programming systems and applications companionCopy-and-paste is a common practice in industrial software development and maintenance, which results in code clones. Prior research has focused on automatically detecting and analyzing code clones from legacy systems and on eliminating clones. We ...
Renaming Parts of Identifiers Consistently within Code Clones
ICPC '10: Proceedings of the 2010 IEEE 18th International Conference on Program ComprehensionCopying and pasting source code results in code duplication. A common form of software reuse involves modifying the new duplicate to fit a current task. The similar code fragments (code clones) may be edited inconsistently by the programmer, for various ...
Aiding Software Maintenance with Copy-and-Paste Clone-Awareness
ICPC '10: Proceedings of the 2010 IEEE 18th International Conference on Program ComprehensionWhen programmers copy, paste, and then modify source code, the once-identical code fragments (code clones) can become indistinguishable as the software evolves over time. In this paper, we present three features of our software tool, a set of Eclipse ...
Comments