Deep Learning Based Feature Envy Detection Boosted by Real-World Examples
Bo Liu, Hui Liu, Guangjie Li, Nan Niu, Zimao Xu, Yifan Wang, Yunni Xia, Yuxia Zhang, Yanjie Jiang
Abstract
Feature envy is one of the well-recognized code smells that should be removed by software refactoring. A major challenge in feature envy detection is that traditional approaches are less accurate whereas deep learning-based approaches are suffering from the lack of high-quality large-scale training data. Although existing refactoring detection tools could be employed to discover real-world feature envy examples, the noise (i.e., non-feature envy) within the resulting data could significantly influence the quality of the training data as well as the performance of the models trained on the data. To this end, in this paper, we propose a sequence of heuristic rules and a decision tree-based classifier to filter out non-feature envy reported by state-of-the-art refactoring detection tools. The data after filtering serve as the positive items in the requested training data. From the same subject projects, we randomly select methods that are different from positive items as negative items. With the real-world examples (both positive and negative examples), we design and train a deep learning-based binary model to predict whether a given method should be moved to a potential target class. Different from existing models, it leverages additional features, i.e., coupling between methods and classes (CBMC) and the message passing coupling between methods and classes (MCMC) that have not yet been exploited by existing approaches. Our evaluation results on real-world open-source projects suggest that the proposed approach substantially outperforms the state of the art in feature envy detection, improving precision and recall by 38.5% and 20.8%, respectively.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext d0ccc499-c139-4fc1-ad4a-9b2c4dc52955Cited by top-tier papers1
Ask how each one uses itRelated papers
- Three Heads Are Better Than One: Suggesting Move Method Refactoring Opportunities with Inter-class Code Entity Dependency Enhanced Hybrid Hypergraph Neural NetworkDi Cui, Jiaqi Wang, Qiangqiang Wang, Peng Ji et al.ASE 2024 · 3 citations
- A Position-Aware Approach to Decomposing God ClassesTianyi Chen, Yanjie Jiang, Fu Fan, Bo Liu et al.ASE 2024 · 2 citations
- DSFM: Enhancing Functional Code Clone Detection with Deep Subtree InteractionsZhiwei Xu, Shaohua Qiang, Dinghong Song, Min Zhou et al.ICSE 2024 · 7 citations
- A Context-based Automated Approach for Method Name Consistency Checking and SuggestionYi Li, Shaohua Wang, Tien N. NguyenICSE 2021 · 36 citations
- DeepVD: Toward Class-Separation Features for Neural Network Vulnerability DetectionWenbo Wang, Tien N. Nguyen, Shaohua Wang, Yi Li et al.ICSE 2023 · 32 citations
