Summary
Understanding how programmers improve and clean up their code is important for reviewing changes and studying software history. The authors found that some code improvements, called refactorings, happen across several code updates instead of just one, making them harder to spot. They call these 'coarse-grained refactorings' and also identified 'ephemeral refactorings,' which can only be seen in single updates but disappear in bigger snapshots. Their study of 32 Java projects showed these types are common and linked to specific code actions like splitting classes or changing inheritance. They suggest that tools should be improved to detect these refactoring types better.
Refactoring detectionCommit historyCoarse-grained refactoringsEphemeral refactoringsSoftware evolutionCode reviewGranularityInheritance structureJava projects
Abstract
Detecting refactorings in commit history is essential to improve comprehension to code changes on code reviews, and to provide valuable information for empirical studies on software evolution. Techniques have been proposed to accurately detect refactorings on the granularity of a single commit. However, refactorings can be made over multiple commits because of their complexity or other practical development problems, which cause detecting on only the granularity of a single commit not enough. We observe that some refactorings can only be detected in coarser granularity, i.e., changes conducted over multiple commits, or in the granularity of a single commit but not in coarse-grained. We call these types of refactorings as coarse-grained refactorings (CGRs) and ephemeral refactorings (EPRs). We investigated the features and causes of CGRs and EPRs through an empirical study of 32 open-source Java projects and found that both commonly occur during development. In addition, we found that refactoring types related to splitting or merging classes and packages, as well as those involving modifications to the inheritance structure, tend to be CGRs, and types targeting small objects such as variables and attributes, and refactorings with context-sensitive detection criteria tend to be EPRs. The causes of CGRs and EPRs are analyzed and categorized, and the relationships between the commit messages of CGRs and themselves are also assessed. We found that about 20% of commit messages explicitly suggest the existence of CGRs. We suggest that CGRs and EPRs be valued in refactoring research and that detectors be extended to identify CGRs.