Context-Sensitive Identification of Refactoring Opportunities

Author(s): Diego Cedrim
Venue: International Conference on Software Engineering
Date: 2016

Type of Experiement: Controlled Experiment
Class/Experience Level: Graduate Student
Data Collection Method: Observation, Project Artifact(s)


Refactoring is a popular procedure for improving the internal structure of software. There are three steps to refactoring: identification of the code to be refactored, selecting the types of refactorings to apply, and actually applying the refactoring. This empirical study focuses on deriving a general model for the first two steps in the refactoring process.

“Code smells”, as proposed by Fowler, represent certain structures that present refactoring opportunities. Code smells are generally used as the only or most important factor for deciding when to start refactoring.The researchers begin by challenging the assumption that code smells directly correspond to the beginnings of refactoring focusing on three questions. “Does code smell suffice as an indicator of refactoring opportunities?”, “What other factors are indicators of refactoring opportunities?”, How the identified contexts are related to refactoring types?” The researchers address their questions by conducting a set of studies through several phases. The first phase is the selection of software projects. Phase 2 is characterizing the context of refactoring opportunities in the project and collecting them. After phase 2 is applied, the researchers can then detect the refactorings that need to be applied in phase 3. Phase 4 applies a machine learning algorithm to solidify it’s findings. And last but not least a phase 5 for validation. The resulting output of applying these 5 phases is a trained machine learning model capable of predicting refactoring opportunities and types that should be applied for each opportunity identified.