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.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call