Three Heads Are Better Than One: Suggesting Move Method Refactoring Opportunities with Inter-class Code Entity Dependency Enhanced Hybrid Hypergraph Neural Network
Methods implemented in incorrect classes will cause excessive reliance on other classes than their own, known as a typical code smell symptom: feature envy, which makes it difficult to maintain increased coupling between classes. Addressing this issue, several Move Method refactoring tools have been proposed, employing a two-phase process: identifying misplaced methods to move and appropriate classes to receive, and implementing the mechanics of refactoring. These tools traditionally use hard-coded metrics to measure correlations between movable methods and target classes and apply heuristic thresholds or trained classifiers to unearth refactoring opportunities. Yet, these approaches predominantly illuminate pairwise correlations between methods and classes while overlooking the complex and complicated dependencies binding multiple code entities within these methods/classes that are prevalent in real-world cases. This narrow focus can lead to refactoring suggestions that may diverge from developers’ actual needs. To bridge this gap, our paper leverages the concept of inter-class code entity dependency hypergraph to model complicated dependency relationships involving multiple code entities within various methods/classes and proposes a hypergraph learning-based approach to suggest Move Method refactoring opportunities named HMove. We first construct inter-class code entity dependency hypergraphs from training samples and assign attributes to entities with a pre-trained code model. All the attributed hypergraphs are fed into a hybrid hypergraph neural network for training. Utilizing this trained neural network alongside a large language model, we construct a refactoring suggestion system. We trained HMove on a large-scale dataset and evaluated it on two real-world datasets. The results show that demonstrates an increase of 27.8% in precision, 2.5% in recall, and 18.5% in f1-measure compared to 9 state-of-the-art refactoring tools, which is more useful for 68% of participants. The results also unveil practical suggestions and new insights that benefit existing feature envy-related refactoring techniques.
Thu 31 OctDisplayed time zone: Pacific Time (US & Canada) change
15:30 - 16:30 | |||
15:30 15mTalk | iSMELL: Assembling LLMs with Expert Toolsets for Code Smell Detection and Refactoring Research Papers Di Wu , Fangwen Mu Institute of Software, Chinese Academy of Sciences, Lin Shi Beihang University, Zhaoqiang Guo Software Engineering Application Technology Lab, Huawei, China, Kui Liu Huawei, Weiguang Zhuang Beihang University, Yuqi Zhong Beihang University, Li Zhang Beihang University | ||
15:45 15mTalk | A Position-Aware Approach to Decomposing God Classes Research Papers Tianyi Chen Beijing Institute of Technology, Yanjie Jiang Peking University, Fu Fan Beijing Institute of Technology, Bo Liu Beijing Institute of Technology, Hui Liu Beijing Institute of Technology | ||
16:00 15mTalk | Three Heads Are Better Than One: Suggesting Move Method Refactoring Opportunities with Inter-class Code Entity Dependency Enhanced Hybrid Hypergraph Neural Network Research Papers Di Cui Xidian University, Jiaqi Wang Xidian University, Qiangqiang Wang Xidian University, Peng Ji Xidian University, Minglang Qiao Xidian University, Yutong Zhao University of Central Missouri, Jingzhao Hu Xidian University, Luqiao Wang Xidian University, Qingshan Li Xidian University | ||
16:15 10mTalk | Copilot-in-the-Loop: Fixing Code Smells in Copilot-Generated Python Code using Copilot NIER Track Beiqi Zhang Wuhan University, Peng Liang Wuhan University, China, Qiong Feng Nanjing University of Science and Technology, Yujia Fu Wuhan University, Zengyang Li Central China Normal University DOI Pre-print |