Refactoring Detection

"Refactoring is the process of changing a software system in such a way
that it does not alter the external behavior of the code yet improves its internal structure."

Martin Fowler in "Refactoring: Improving The Design Of Existing Code"

In this project we are concerned with the problem of reconstructing refactorings that occured during the evolution of a software system. This analysis can be helpful for improving the software engineering process. For example, detected refactorings can help the programmer to re-understand the program code after being absent for a certain time. Refactorings detected in software archives can also be used to identify errors that have occured during the software development. Futhermore, the refactoring information provides new insights how software projects evolve over time.

We are dealing in particular with the problem of reconstructing refactorings that have been performed during the evolution of a software. As in general it is undecidable if a change is a refactoring (that means the change only alters the structure, but not the behavior), we have to use heuristics. One main challenge is to find good heuristics and evaluate them.

Approach

We have developed a signature-based analysis approach to find out if a set of (concurrent) changes extracted from the version archives of a software may be a refactoring ([IWPC05, ASE06]). We call such a set a refactoring candidate. It turned out, that the signature-based approach has a good recall but a poor precision. However, using code-clone detection for ranking the candidates and sorting wrong ones out, we were able to increase the precision crucialy while the recall stays at a good level ([ASE06]).

Applications

Refactoring reconstruction is a prerequisite for many applications, among them error detection (because of inconsistent refactorings, [MSR05]), capturing the intent of changes, and capturing changes to a library and relaying them to client software. Furthermore, it enables us to perform case studies to examine if refactorings are less error-prone than other changes, or in which phases of development refactorings are mainly done ([MSR06, MSRChallenge06]). Last but not least, refactorings reconstructed from history can be visualized in order to help programmers that have been absent for a while to understand there code again ([IWPC05]).

Components

  • LibReDe
    • Refactoring Detection Libary
    • Detects refactoring candidates in modified code
    • Highly configurable
  • LibRepInf
    • Provides access to CVS- and SVN-repositories
    • Preprocesses these repositories and archives them in a relational database
    • Transaction recovery for CVS
    • Easy query on DB via API
  • LibParser

    • ANTLR based parser for JAVA files

    • Returns abtract descriptions of classes, methods and fields in JAVA files

Publications

  • Identifying Refactorings from Source-Code Changes
    P. Weißgerber, S. Diehl in Proceedings 21st IEEE/ACM International Conference on Automated Software Engineering
    ASE06, Tokyo, Japan, Sep 2006. This paper won the ASE06 Best Paper Award. 
  • Mining Refactorings in ARGOUML
    P. Weißgerber, S. Diehl and C. Görg
    (MSR Challenge report) in Proceedings of the 3rd International Workshop on Mining Software Repositories MSR 2006, Shanghai, China, May 2006. 
  • Are Refactorings Less Error-prone Than Other Changes?
    P. Weißgerber and S. Diehl
    in Proceedings of the 3rd International Workshop on Mining Software Repositories MSR 2006, Shanghai, China, May 2006.  
  • An Interactive Visualization of Refactorings Retrieved from Software Archives
    P. Weißgerber, S. Diehl and C. Görg
    in Proceeding ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications ​​​​​​​OOPSLA05, San Diego, California, USA, Oct 2005.  
  • Detecting and Visualizing Refactorings from Software Archives
    C. Görg, P. Weißgerber
    in Proceeding International Workshop on Program Comprehension ​​​​​​​IWPC05, St. Louis, Missouri, USA, May 2005. 
  • Error Detection by Refactoring Reconstruction
    C. Görg, P. Weißgerber
    in Proceedings International Workshop on Mining Software Repositories​​​​​​​ MSR05, St. Louis, Missouri, USA, May 2005.  
  • Preprocessing CVS Data for Fine-Grained Analysis
    T. Zimmermann, P. Weißgerber
    in Proceedings International Workshop on Mining Software Repositories ​​​​​​​MSR04, Edinburgh, Scotland, UK, May 2004.