Energy-aware evolutionary multi-objective refactoring for bad code smells correction of Android applications
Among the topics in the field of software engineering, energy efficiency is an influential factor in software development and maintenance, especially for battery-limited devices. Although software refactoring can improve software quality, recent studies suggest that applying some refactoring operators may lead to conflicts with energy consumption and execution time of Android applications. In this paper, we analyze the impact of code refactoring for eight Android/Java bad code smells and anti-patterns. To conduct the studies and obtain the results, we use a testbed of five real and one synthetic Android applications. In the first step, we measure energy consumption, execution time and quality design of application before and after refactoring. The results show that in some cases, refactoring leads to a decrease in energy consumption and execution time, and in others, it increases energy consumption and application execution time. We then propose a novel refactoring recommendation approach based on evolutionary multi-objective optimization that accounts for energy consumption, execution time and refactoring effort for Android/Java anti-patterns. For this purpose, we use Nondominated Sorting Genetic Algorithm-II (NSGA-II) with three objectives 1) energy consumption, 2) execution time, and 3) refactoring effort. The obtained results show that this approach can generate refactoring recommendations with a median precision of 65% and 76% for improving energy and execution time, respectively, while the median of removed antipatterns in testbed applications is 42%.