Alexandria Engineering Journal (Sep 2018)
Model level code smell detection using EGAPSO based on similarity measures
Abstract
Software maintenance is an essential part of any software that finds its use in the day-to-day activities of any organization. During the maintenance phase bugs detected must be corrected and the software must evolve with respect to changing requirements without ripple effects. Software maintenance is a cumbersome process if code smells exist in the software. The impact of poor design is code smells. In code smells detection, majority of the existing approaches are rule based, where a rule represents the combination of metrics and threshold. In rule based approach, defining the rules that detect the code smells are time consuming because identifying the correct threshold value is a tedious task, which can be fixed only through trial and error method. To address this issue, in this work Euclidean distance based Genetic Algorithm and Particle Swarm Optimization (EGAPSO) is used. Instead of relying on threshold value, this approach detects all code smells based on similarity between the system under study and the set of defect examples, where the former is the initial model and the latter is the base example. The approach is tested on the open source projects, namely Gantt Project and Log4j for identifying the five code smells namely Blob, Functional Decomposition, Spaghetti Code, Data Class and Feature Envy. Finally, the approach is compared with code smell detection using Genetic Algorithm (GA), DEtection and CORrection (DECOR), Parallel Evolutionary Algorithm (PEA) and Multi-Objective Genetic Programming (MOGP). The result of EGAPSO proves to be effective when compared to other code smell detection approaches. Keywords: Software maintenance, Code smell, Software metrics, Search based software engineering, Euclidean distance, Open source software