Supporting Copy-and-Paste Programming inside IDEs
Built On Eclipse

Release of CSeR 1.0 is planned for early Spring 2009.

Both CReN and CnP have been improved significantly last year. In addition to CReN, CnP now includes features like importing output from clone detection tools (SimScan, specifically). And Ferosh is working on another feature CSeR.

CReN version 1.0 is released!

Programmers often copy and paste code so that they can reuse existing code to complete a similar task and/or save time. Many times, they modify the pasted code. The objective of the CnP project is to prototype a family of IDE features to track the copy-pasting relationship and facilitate the process of modifying pasted code. We intend to formally validate the effectiveness of these features in improving programmer productivity. So far, two main features (CReN for Consistent ReNaming and CSeR for Code Segments Reuse) have been prototyped and several more are in planning stage. We have demonstrated these features in venues like OOPSLA 2007 and CASCON 2008 (Technology Showcase and DemoCamp). Overall, the feedback we received from researchers and practitioners is positive and encouraging. We are interested in collaboration and industrial support to help us move this project forward.

One kind of common modifications to the newly pasted code is renaming all instances of an identifier, such as a variable name, consistently throughout the fragment. It can be tedious to make such modifications manually. Furthermore, 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. CReN is a feature that automatically and consistently renames all occurrences of the same identifier when any one of them is being modified in the editor. CReN works on not only copy-pasted code fragments but also arbitrary code regions selected by programmers. Thus, CReN can be viewed as a generalized version of the renaming refactoring currently available in IDEs like Eclipse.

CReN Demo Movie (Need Quicktime player to play)

Free Quicktime Player for Windows can be downloaded from Apple, Inc.

Programmers also copy-paste large pieces of code like one or more classes or multiple methods. They often need to modify the pasted code according to the need of a local context where the code is pasted. For example, they may change a few methods together because these methods are logically related, or they may delete some methods. The goal of CSeR is to capture the modifications that one programmer makes to the pasted code and present these knowledge in a suitable format to another programmer when he/she copy-pastes the same code a second time. In certain cases, it may even be possible for CSeR to automate some of the modifications. Our hypothesis is that with the tacit knowledge provided by CSeR, programmers will be able to speed up the modification process and avoid coding errors.

CSeR Demo Movie (Need Quicktime player to play)