Vol.64, No.3, 2020, pp.1999-2012, doi:10.32604/cmc.2020.09950
OPEN ACCESS
ARTICLE
A Recommendation Approach Based on Bayesian Networks for Clone Refactor
  • Ye Zhai1, *, Dongsheng Liu1, Celimuge Wu2, Rongrong She1
1 Inner Mongolia Normal University, Hohhot, 010022, China.
2 Graduate School of Informatics and Engineering, The University of Electro-Communications, Tokyo, 182- 8585, Japan.
* Corresponding Author: Ye Zhai. Email: cieczy@imnu.edu.cn.
Received 31 January 2020; Accepted 09 May 2020; Issue published 30 June 2020
Abstract
Reusing code fragments by copying and pasting them with or without minor adaptation is a common activity in software development. As a result, software systems often contain sections of code that are very similar, called code clones. Code clones are beneficial in reducing software development costs and development risks. However, recent studies have indicated some negative impacts as a result. In order to effectively manage and utilize the clones, we design an approach for recommending refactoring clones based on a Bayesian network. Firstly, clone codes are detected from the source code. Secondly, the clones that need to be refactored are identified, and the static and evolutions features are extracted to build the feature database. Finally, the Bayesian network classifier is used for training and evaluating the classification results. Based on more than 640 refactor examples of five open source software developed in C, we observe a considerable enhancement. The results show that the accuracy of the approach is larger than 90%. We believe our approach will provide a more accurate and reasonable code refactoring and maintenance advice for software developers.
Keywords
Clone code, clone refactor, feature extraction, Bayesian network.
Cite This Article
Zhai, Y., Liu, D., Wu, C., She, R. (2020). A Recommendation Approach Based on Bayesian Networks for Clone Refactor. CMC-Computers, Materials & Continua, 64(3), 1999–2012.