Refactoring restructures a program to improve its structure without altering its behavior. However, it is challenging to preserve the domain semantics of a program when refactoring is decided/implemented automatically. Indeed, a program... more
Refactoring restructures a program to improve its structure without altering its behavior. However, it is challenging to preserve the domain semantics of a program when refactoring is decided/implemented automatically. Indeed, a program could be syntactically correct, have the right behavior, but model incorrectly the domain semantics. In this paper, we propose a multi-objective optimization approach to find the best sequence of refactorings that maximizes quality improvements (program structure) and minimizes semantic errors. To this end, we use the non-dominated sorting genetic algorithm (NSGA-II) to find the best compromise between these two conflicting objectives. We report the results of our experiments on different open source projects.