On Refactoring for Open Source Java Program
Yoshiki Higo, Toshihiro Kamiya, Shinji Kusumoto, Katsuro Inoue, Yoshio Kataoka
Abstract
Yoshiki Higo, Toshihiro Kamiya, Shinji Kusumoto, Katsuro Inoue, Yoshio Kataoka
Abstract
Software maintenance is the most expensive activity in software development process. It have been reported that many software companies spent a large amount of cost to maintain the existing systems. Refactoring is an effective technique to conduct the perfective maintenance. It is defined as “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.” Code clone makes software maintenance difficult and so is called a typical ‘badsmell’. A code clone is a code fragment in a source code that is identical or similar to another. In an actual software development process, code clones are introduced because of various reasons such as reusing code by ‘copyand-paste’ and so on. This paper describes the application of the refactoring to an open source Java program, ANTLR, using a code clone analysis. First, we extract some code clones from the source code with a code clone detection tool. Second, we identify some code clones that some refactoring patterns could be applied to. Finally, we apply the refactoring patterns to the code clones and rewrite the code. The result shows that the applied two refactoring patterns “Extract Method” and “Pull Up Method” reduce the code size by 1000LOC. Also we confirm that the behavior of the ANTLR after the refactoring is the same as before.
OpenAlex reports 1 citations for this work. Citation counts describe recorded attention and do not establish research quality.
A contribution statement is not available in the OpenAlex record.
Method details are not available in the OpenAlex metadata.
Findings are not separately available in the OpenAlex metadata.
Limitations are not available in the OpenAlex metadata.
Application details are not available in the OpenAlex metadata.
Software maintenance is the most expensive activity in software development process. It have been reported that many software companies spent a large amount of cost to maintain the existing systems. Refactoring is an effective technique to conduct the perfective maintenance. It is defined as “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.” Code clone makes software maintenance difficult and so is called a typical ‘badsmell’. A code clone is a code fragment in a source code that is identical or similar to another. In an actual software development process, code clones are introduced because of various reasons such as reusing code by ‘copyand-paste’ and so on. This paper describes the application of the refactoring to an open source Java program, ANTLR, using a code clone analysis. First, we extract some code clones from the source code with a code clone detection tool. Second, we identify some code clones that some refactoring patterns could be applied to. Finally, we apply the refactoring patterns to the code clones and rewrite the code. The result shows that the applied two refactoring patterns “Extract Method” and “Pull Up Method” reduce the code size by 1000LOC. Also we confirm that the behavior of the ANTLR after the refactoring is the same as before.
Key concepts: Code refactoring, Computer science, Software maintenance, Programming language, Source code, Java, KPI-driven code analysis, Code (set theory)