Automatic code locations identification for replacing temporary variable with query method

Main Article Content

Songsakdi Rongviriyapanish
Nopphawit Karunlanchakorn
Panita Meananeatra

Abstract

Automatic application of refactoring techniques can help developer save effort in removing bad smells from their code which improves software maintainability. To automatically remove long method bad smell, which is one of the most serious bad smells, we need an automatic application of six refactoring techniques. However, only one refactoring technique “Extract Method” can be automated. In this research, we propose an algorithm to identify code locations which will be extracted for creating a query method. We create a program dependence graph from the code with a long method bad smell and use a technique of program slicing to identify the code of a query method to replace a temporary variable. This is the most important step towards an automatic application of refactoring technique “replace temp with query”. We conducted an experiment to compare the correctness of refactored code between using our algorithm and using IntelliJ IDEA that is a java integrated development environment (IDE) with a feature of automatic refactoring. The result confirmed that our proposed algorithm can identify codes to form a query method for replacing a temporary variable in a long method with higher accuracy than IntelliJ IDEA almost three times

Article Details

How to Cite
[1]
S. Rongviriyapanish, N. Karunlanchakorn, and P. Meananeatra, “Automatic code locations identification for replacing temporary variable with query method”, ECTI-CIT Transactions, vol. 10, no. 1, pp. 88–96, Apr. 2016.
Section
Artificial Intelligence and Machine Learning (AI)