ABSTRACT

Several studies show that programmers are postponing software maintenance activities that improve software quality, even while seeking high-quality source code for themselves when updating existing projects. High-quality source code can be characterized using several quality attributes, but maintaining this high level of quality is expensive. One reason is that time and monetary pressures force programmers to neglect to enhance the quality of their source code while enhancing existing systems with new features or fixing bugs. Code smells represent symptoms of poor implementation choices. For instance, a Blob has several symptoms such as a large class, high number of methods, low cohesion and high coupling. Code smells are frequent in variability-intensive software systems since their requirements change extensively over time, and developers have limited time to meet the deadlines and provide new releases. Previous studies found that these smells make source code more difficult to maintain, possibly also increasing its fault-proneness. There is a plethora of approaches that identify bad smells based on code-analysis techniques. We propose, in this chapter, to consider code smells correction as a distributed problem. Different techniques are combined during an optimization process to find a consensus regarding the correction of code smells. To this end, we used distributed evolutionary algorithms (D-EA) where many evolutionary algorithms with different adaptations (fitness functions, solution representation and change operators) are executed in parallel to solve a common goal which is the correction of code smells. The statistical analysis of the obtained results provide evidence to support the claim that cooperative D-EA outperforms single population evolution and random search based on a benchmark of eight large open-source systems where more than 86% of code smells are fixed using the suggested refactorings.