arrow
Return

Code clone classification based on multi-dimension feature entropy

delete2025-12-01
delete0
PRE
AI
B
Bin Hu
L
Lizhi Zheng
D
Dongjin Yu *
Y
Yijian Wu
J
Jie Chen
T
Tianyi Hu
DOI:10.1016/j.scico.2025.103419delete
deleteOriginal
deleteShare
deleteSave
Abstract

Abstract

En 中文
Code clones have been a hot topic in software engineering for decades. Due to the rapid development of clone detection techniques, it is not difficult to find code clones in software systems, while managing the vast amounts of clones remains an open problem. Typically, we should adopt refactoring approaches to eliminate clones, thereby mitigating the threat to software maintenance. In some situations, the clone group may contain several different code variants that reside in different locations, thus making refactoring too complicated, as their differences must be analyzed and reconciled before refactoring. Therefore, we should find an approach to recognize clone groups that are easy to refactor or eliminate. In this paper, we first collected large-scale datasets from three different domains and studied the distribution of four different metrics of code clones. We found that the distribution of each metric follows a certain pattern, the number of inner file clone accounts for approximately 50%, the number of Type3 clone accounts for above 45%. But we cannot judge the complexity of code clone groups based solely on these metrics. Based on our findings, we propose a classification approach to assist developers to find clone groups that are easy to eliminate by refactoring from those that are hard to refactor. We propose four different clone feature entropy measures based on information entropy theory, including variant entropy, distribution entropy, relation entropy, and syntactic entropy. Then, we calculate fused clone entropy, which is the weighted summation of the above four clone feature entropy. Finally, we use the four types of feature entropy and the fused feature entropy to classify or rank code clone groups. Experiments on three different application domains show that the proposed clone feature entropy can help developers identify clone groups that are easy to eliminate by refactoring. Manual validation also reveals that the complexity of clone groups is not solely dependent on the number of clone instances. This approach provides a new way to manage code clones and offers some useful ideas for future clone maintenance research.
Keywords:
Code clone analysis
Clone density
Clone entropy
Prioritisation of code clones using a genetic algorithm
err2024-06-01
err0
PREAI
errAzadi, Umberto; Walter, Bartosz; Fontana, Francesca Arcelli
errShare
errSave
Code2Img: Tree-Based Image Transformation for Scalable Code Clone Detection
err2023-09-01
err5
PREAI
errHu, Yutao; Fang, Yilin; Sun, Yifan; Jia, Yaru; Wu, Yueming; Zou, Deqing; Jin, Hai
errShare
errSave
A machine learning based framework for code clone validation
err2020-11-01
err10
errOAAI
errMostaeen, Golam; Roy, Banani; Roy, Chanchal K.; Schneider, Kevin; Svajlenko, Jeffrey
errShare
errSave
errShare
errSave
Classification model for code clones based on machine learning
err2014-05-29
err33
errOAAI
errYang, Jiachen; Hotta, Keisuke; Higo, Yoshiki; Igaki, Hiroshi; Kusumoto, Shinji
errShare
errSave
Clones in deep learning code: what, where, and why?
err2022-04-08
err4
PREAI
errJebnoun, Hadhemi; Rahman, Md Saidur; Khomh, Foutse; Muse, Biruk Asmare
errShare
errSave

Journal

S
Science of Computer Programming
IF:
1.4
Papers:
51
Citations:
1.6K

Organization

Hangzhou Dianzi University cover
Hangzhou Dianzi University
Scholars:
2.0K
Papers: 654
Citations: 6.0K
fudan university cover
fudan university
Scholars:
1.0W
Papers: 2.8K
Citations: 5.6W
Cited Papers

Cited Papers

A graph-based code representation method to improve code readability classification
err2023-05-23
err4
PREAI
errMi, Qing; Zhan, Yi; Weng, Han; Bao, Qinghang; Cui, Longjie; Ma, Wei
errShare
errSave
Analyzing cloning evolution in the Linux kernel
err2002-10-01
err93
PREAI
errAntoniol, G; Villano, U; Merlo, E; Di Penta, M
errShare
errSave
Classifying Obstructive and Nonobstructive Code Clones of Type I Using Simplified Classification Scheme: A Case Study
err2015-12-21
err0
PREAI
errStaron,Miroslaw; Meding,Wilhelm; Eriksson,Peter; Nilsson,Jimmy; Lövgren,Nils; Österström,Per
errShare
errSave
An investigation of the fault-proneness of clone evolutionary patterns
err2017-06-13
err0
PREAI
errLiliane Barbour; Le An; Foutse Khomh; Ying Zou; Shaohua Wang
errShare
errSave
Vulnerable Code Clone Detection for Operating System Through Correlation-Induced Learning
err2019-12-01
err10
PREAI
errShi, Heyuan; Wang, Runzhe; Fu, Ying; Jiang, Yu; Dong, Jian; Tang, Kun; Sun, Jiaguang
errShare
errSave
Clone Management for Evolving Software
err2012-09-01
err83
PREAI
errHoan Anh Nguyen; Tung Thanh Nguyen; Pham, Nam H.; Al-Kofahi, Jafar; Nguyen, Tien N.
errShare
errSave
Assessing the Refactorability of Software Clones
err2015-11-01
err59
PREAI
errTsantalis, Nikolaos; Mazinanian, Davood; Krishnan, Giri Panamoottil
errShare
errSave
researcher View more