Finding Code Clone Refactoring Techniques by Mapping Clone Context
| Authors | |
|---|---|
| Publication date | 2023 |
| Host editors |
|
| Book title | Composability, Comprehensibility and Correctness of Working Software |
| Book subtitle | 8th Summer School, CEFP 2019, Budapest, Hungary, June 17–21, 2019 : revised selected papers |
| ISBN |
|
| ISBN (electronic) |
|
| Series | Lecture Notes in Computer Science |
| Event | 8th Central European Functional Programming School, CEFP 2019 |
| Pages (from-to) | 344-357 |
| Number of pages | 14 |
| Publisher | Cham: Springer |
| Organisations |
|
| Abstract |
Reducing clones in source code is one of the techniques to improve the maintainability of a software system. Which refactoring technique to use depends on where a clone is found and what the relation between clone instances in a clone class is. We define three influencing factors on how a clone should be refactored: relation, location, and contents. The relation describes the inheritance relation among the clone instances in a clone class. The location describes where a clone instance is found in the source code. The contents describe what a clone instance spans. Based on experiments on a corpus of open-source Java projects we find that most clones (77%) are in the body of methods or constructors and thus the “Extract Method” refactoring technique applies. What further techniques are required for the refactoring depends on the relation among the clone instances of a clone. We define four relations that require different further refactoring techniques: Common Class, Common Hierarchy, Common Interface, and Unrelated. The closer classes are related, the more favorable refactoring clones by such relations becomes. 37% of clones are in the same class, 24% share an inheritance hierarchy, 24% are unrelated and 15% have a common interface. |
| Document type | Conference contribution |
| Language | English |
| Published at | https://doi.org/10.1007/978-3-031-42833-3_9 |
| Other links | https://www.scopus.com/pages/publications/85175991080 |
| Permalink to this page | |
