TY - JOUR
T1 - Model-based source code refactoring with interaction and visual cues
AU - Hemati Moghadam, Iman
AU - Ó Cinnéide, Mel
AU - Sardarian, Ali
AU - Zarepour, Faezeh
N1 - Publisher Copyright:
© 2023 The Authors. Journal of Software: Evolution and Process published by John Wiley & Sons Ltd.
PY - 2024/5
Y1 - 2024/5
N2 - Refactoring 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.
AB - Refactoring 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.
KW - UT-Hybrid-D
KW - interactive
KW - model-based refactoring
KW - search-based refactoring
KW - visual cues
KW - design exploration
UR - http://www.scopus.com/inward/record.url?scp=85165162267&partnerID=8YFLogxK
U2 - 10.1002/smr.2596
DO - 10.1002/smr.2596
M3 - Article
AN - SCOPUS:85165162267
SN - 2047-7473
VL - 36
JO - Journal of software: Evolution and Process
JF - Journal of software: Evolution and Process
IS - 5
M1 - e2596
ER -