MIRROR: Multi-objective Refactoring Recommendation via Correlation Analysis


Refactoring is a critical but complex task to improve the code quality by altering software structure without changing the observable behavior. Although there are many refactoring tools available to recommend refactoring solutions, however, almost all previous reconstructive recommendation techniques only considered the overall attributes and lacked the importance of considering the sub-attributes and their correlations. And in previous approaches, refactoring solutions focused on only a few common types of refactoring operations. Responding to the above issues, this paper proposes an approach,named Multi-objectIve Refactoring Recommendation via Correlation Analysis(MIRROR).

We developed an Eclipse plugin called MIRROR to automatically generate a list of refactoring recommendations. MIRROR can recommend refactorings from different perspectives to (i) improve quality, (ii) remove the code smell, and (iii) maximize the similarity to refactoring history. We envision MIRROR to be used in at least two usage scenarios. First, we claim that MIRROR is especially beneficial in providing recommendations for those attributes with several sub-attributes among which correlations can be quantified. Second, owing to the adoption of numerous types of refactoring, MIRROR is particularly appropriate to recommend various types of refactoring.

The tool uses the Java project to be refactored as input and is able to find the best compromise between three objectives while providing more reasonable refactorings. To evaluate the effectiveness of MIRROR, extensive experimental evaluations are conducted on 6 large open-source projects and compare MIRROR in various aspects with two existing tools. The experimental results show that MIRROR improves the F1 by up to 5.63% and 3.75% compared with existing refactoring recommendation tools JMove and QMove.

MIRROR is a prototyping tool designed to demonstrate its basic functionality and potential value, and to validate the feasibility and acceptability of our ideas. With MIRROR, we hope to provide a new way to address the importance of neglected subattributes and their dependencies. Because MIRROR is still in the prototype stage, there may be some limitations and incomplete features. Our goal is to continuously optimize and refine it through user feedback and further improvements to be able to better understand potential needs and directions for improvement.

MIRROR tools and Setup


MIRROR tools

The source code for the MIRROR tool is available based on your request.

MIRROR Setup

1 The plug-in is available for the Eclipse Integrated Development Environment (IDE).

2 Installation method:Download the source code, import it to eclipse, and restart Eclipse.

3 Configuration instructions: 1)need to download the jar package including the asm-5.0.4(asm-5.0.4), jxl-2.6.12(jxl-2.6.12) and the recoder(recorder). 2)use Iplasma (iPlasma) and Refactoring Miner to collect target set.

4 Project: GanttProject-V1.10.2(ganttproject),Rhino-V.1.7R1(rhino),JHotDraw-V6.1(jhotdraw),ApacheAnt-V1.8.2(apacheant),Xerces-J-V2.7.0(xerces-j) and JFreeChart-V.1.5.2(jfreechart).