Authors: G. Saranya; H. Khanna Nehemiah; A. Kannan
Addresses: Ramanujan Computing Centre, Anna University, Chennai - 600025, India ' Ramanujan Computing Centre, Anna University, Chennai - 600025, India ' Department of Information Science and Technology, Anna University, Chennai - 600025, India
Abstract: Code smells are characterised as the structural defects in the software which indicate a poor software design and in turn makes the software hard to maintain. However, detecting and fixing the code smell in the software is a time consuming process, and it is difficult to fix manually. In this paper, an algorithm named as hybrid particle swarm optimisation with mutation (HPSOM) is used for identification of code smell by automatic generation of rules which represent the combination of metrics and threshold. Moreover, an empirical evaluation to compare HPSOM with other evolutionary approaches such as the parallel evolutionary algorithm (PEA), genetic algorithm (GA), genetic programming (GP) and particle swarm optimisation (PSO) to detect the code smell is done. The analysis shows that the HPSOM algorithm performs better than other approaches when applied on nine open source projects, namely, JfreeChart, GanttProject, ApacheAnt 5.2, ApacheAnt 7.0, Nutch, Log4J, Lucene, Xerces-J and Rhino. HPSOM approach has achieved precision of 94% and recall of 92% on five different types of code smells namely, blob, data class, spaghetti code, functional decomposition and feature envy.
Keywords: search-based software engineering; code smell; evolutionary algorithms; software maintenance; software metrics; particle swarm optimisation; PSO; hybrid particle swarm optimisation; cohesion; coupling; open source software.
International Journal of Bio-Inspired Computation, 2018 Vol.12 No.3, pp.186 - 195
Received: 10 Aug 2016
Accepted: 16 Mar 2017
Published online: 04 Sep 2018 *