Abstract

AbstractRefactoring source code involves the developer in a myriad of program detail that can obscure the design changes that they actually wish to bring about. On the other hand, refactoring a UML model of the code makes it easier to focus on the program design, but the burdensome task of applying the refactorings to the source code is left to the developer. In an attempt to obtain the advantages of both approaches, we propose a refactoring approach where the interaction with the developer takes place at the model level, but the actual refactoring occurs on the source code itself. We call this approach model‐based source code refactoring and implement it in this paper using two tools: (1) Design‐Imp enables the developer to use interactive search‐based design exploration to create a UML‐based desired design from an initial design extracted from the source code. It also provides visual cues to improve developer comprehension during the design‐level refactoring process and to help the developer to discern between promising and poor refactoring solutions. (2) Code‐Imp then refactors the original source so that it has the same functional behavior as the original program, and a design close to the one produced in the design exploration phase, that is, a design that has been confirmed as “desirable” by the developer. We evaluated our approach involving interaction and visual cues with industrial developers refactoring three Java projects, comparing it with an approach using interaction without visual cues and a fully automated approach. The results show that our approach yields refactoring sequences that are more acceptable both to the individual developer and to a set of independent expert refactoring evaluators. Furthermore, our approach removed more code smells and was evaluated very positively by the experiment participants.

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