skip to main content
10.1145/3650212.3685307acmconferencesArticle/Chapter ViewAbstractPublication PagesisstaConference Proceedingsconference-collections
research-article

HECS: A Hypergraph Learning-Based System for Detecting Extract Class Refactoring Opportunities

Published: 11 September 2024 Publication History

Abstract

HECS is an advanced tool designed for Extract Class refactoring by leveraging hypergraph learning to model complex dependencies within large classes. Unlike traditional tools that rely on direct one-to-one dependency graphs, HECS uses intra-class dependency hypergraphs to capture one-to-many relationships. This allows HECS to provide more accurate and relevant refactoring suggestions. The tool constructs hypergraphs for each target class, attributes nodes using a pre-trained code model, and trains an enhanced hypergraph neural network. Coupled with a large language model, HECS delivers practical refactoring suggestions. In evaluations on large-scale and real-world datasets, HECS achieved a 38.5% increase in precision, 9.7% in recall, and 44.4% in f1-measure compared to JDeodorant, SSECS, and LLMRefactor. These improvements make HECS a valuable tool for developers, offering practical insights and enhancing existing refactoring techniques.

References

[1]
2024. HECS Archived Version. https://doi.org/10.5281/zenodo.12662219
[2]
2024. HECS Demo Video. https://www.youtube.com/watch?v=-Jtss1eKo5U
[3]
2024. HECS Source Code. https://github.com/cnznb/HECS/
[4]
Marios Fokaefs A, Nikolaos Tsantalis A, Eleni Stroulia A, and Alexander Chatzigeorgiou B. 2012. Identification and application of Extract Class refactorings in object-oriented systems. Journal of Systems and Software, 85, 10 (2012), 2241–2260.
[5]
Pritom Saha Akash and Kevin Chen-Chuan Chang. 2022. Exploring Variational Graph Auto-Encoders for Extract Class Refactoring Recommendation. arxiv:2203.08787.
[6]
P. S. Akash, A. Sadiq, and A. Kabir. 2019. An Approach of Extracting God Class Exploiting Both Structural and Semantic Similarity. In International Conference on Evaluation of Novel Software Approaches to Software Engineering.
[7]
Gabriele Bavota, Bernardino De Carluccio, Andrea De Lucia, Massimiliano Di Penta, Rocco Oliveto, and Orazio Strollo. 2012. When does a refactoring induce bugs? an empirical study. In 2012 IEEE 12th International Working Conference on Source Code Analysis and Manipulation. 104–113.
[8]
G. Bavota, A. D. Lucia, A. Marcus, and R. Oliveto. 2014. Automating extract class refactoring: an improved method and its evaluation. Empirical Software Engineering, 19, 6 (2014), 1617–1664.
[9]
G. Bavota, A. D. Lucia, and R. Oliveto. 2011. Identifying Extract Class refactoring opportunities using structural and semantic cohesion measures. Journal of Systems & Software, 84, 3 (2011), 397–414.
[10]
Di Cui, Qiangqiang Wang, Siqi Wang, Jianlei Chi, Jianan Li, Lu Wang, and Qingshan Li. 2023. REMS: Recommending Extract Method Refactoring Opportunities via Multi-view Representation of Code Property Graph. In 2023 IEEE/ACM 31st International Conference on Program Comprehension (ICPC). 191–202.
[11]
Di Cui, Qiangqiang Wang, Yutong Zhao, Jiaqi Wang, Minjie Wei, Jingzhao Hu, Luqiao Wang, and Qingshan Li. 2024. One-to-One or One-to-Many? Suggesting Extract Class Refactoring Opportunities with Intra-class Dependency Hypergraph Neural Network. In Proceedings of the 33nd ACM SIGSOFT International Symposium on Software Testing and Analysis, (ISSTA).
[12]
Di Cui, Siqi Wang, Yong Luo, Xingyu Li, Jie Dai, Lu Wang, and Qingshan Li. 2022. RMove: Recommending Move Method Refactoring Opportunities using Structural and Semantic Representations of Code. In 2022 IEEE International Conference on Software Maintenance and Evolution (ICSME). 281–292.
[13]
Massimiliano Di Penta, Gabriele Bavota, and Fiorella Zampetti. 2020. On the relationship between refactoring actions and bugs: a differentiated replication. In Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering. 556–567.
[14]
Martin Fowler. 1997. Refactoring: improving the design of existing code. Addison-Wesley Professional.
[15]
Mouna Hadj-Kacem and Nadia Bouassida. 2019. Deep representation learning for code smells detection using variational auto-encoder. In 2019 International Joint Conference on Neural Networks (IJCNN). 1–8.
[16]
T. Jeba, T. Mahmud, P. S. Akash, and N. Nahar. 2020. God Class Refactoring Recommendation and Extraction Using Context based Grouping. International Journal of Information Technology and Computer Science.
[17]
Wuxia Jin, Yuanfang Cai, Rick Kazman, Qinghua Zheng, Di Cui, and Ting Liu. 2019. ENRE: a tool framework for extensible eNtity relation extraction. In Proceedings of the 41st International Conference on Software Engineering: Companion Proceedings. 67–70.
[18]
Foutse Khomh, Stéphane Vaucher, Yann-Gaël Guéhéneuc, and Houari Sahraoui. 2009. A Bayesian Approach for the Detection of Code and Design Smells. In 2009 Ninth International Conference on Quality Software. 305–314. https://doi.org/10.1109/QSIC.2009.47
[19]
Tom Mens, Gabriele Taentzer, and Olga Runge. 2007. Analysing refactoring dependencies using graph transformation. Software & Systems Modeling, 6, 3 (2007).
[20]
Tom Mens, Niels Van Eetvelde, Serge Demeyer, and Dirk Janssens. 2005. Formalizing refactorings with graph transformations. Journal of Software Maintenance and Evolution: Research and Practice, 17, 4 (2005), 247–276.
[21]
Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781.
[22]
James Munkres. 1957. Algorithms for the assignment and transportation problems. Journal of the society for industrial and applied mathematics, 5, 1 (1957), 32–38.
[23]
Emerson Murphy-Hill, Chris Parnin, and Andrew P Black. 2011. How we refactor, and how we know it. IEEE Transactions on Software Engineering, 38, 1 (2011), 5–18.
[24]
William F Opdyke. 1992. Refactoring object-oriented frameworks. University of Illinois at Urbana-Champaign.
[25]
W. F. Opdyke and R. E. Johnson. 1992. Refactoring Object-Oriented Frameworks. University of Illinois at Urbana-Champaign.
[26]
Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, and Alex Ray. 2022. Training language models to follow instructions with human feedback. Advances in neural information processing systems, 35 (2022), 27730–27744.
[27]
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Köpf, Edward Yang, Zach DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. 2019. PyTorch: An Imperative Style, High-Performance Deep Learning Library. Curran Associates Inc., Red Hook, NY, USA.
[28]
Max Schäfer, Julian Dolby, Manu Sridharan, Emina Torlak, and Frank Tip. 2010. Correct refactoring of concurrent Java code. In ECOOP 2010–Object-Oriented Programming: 24th European Conference, Maribor, Slovenia, June 21-25, 2010. Proceedings 24. 225–249.
[29]
Atsushi Shirafuji, Yusuke Oda, Jun Suzuki, Makoto Morishita, and Yutaka Watanobe. 2023. Refactoring Programs Using Large Language Models with Few-Shot Examples. arXiv preprint arXiv:2311.11690.
[30]
Danilo Silva, Nikolaos Tsantalis, and Marco Tulio Valente. 2016. Why we refactor? confessions of github contributors. In Proceedings of the 2016 24th acm sigsoft international symposium on foundations of software engineering. 858–870.
[31]
F. Simon, F. Steinbruckner, and C. Lewerentz. 2001. Metrics based refactoring. In European Conference on Software Maintenance & Reengineering.
[32]
Alexey Svyatkovskiy, Ying Zhao, Shengyu Fu, and Neel Sundaresan. 2019. Pythia: Ai-assisted code completion system. In Proceedings of the 25th ACM SIGKDD international conference on knowledge discovery & data mining. 2727–2735.
[33]
Nikolaos Tsantalis and Alexander Chatzigeorgiou. 2011. Identification of extract method refactoring opportunities for the decomposition of methods. Journal of Systems and Software, 84, 10 (2011), 1757–1782.
[34]
N. Tsantalis, A. S. Ketkar, and D. Dig. 2020. RefactoringMiner 2.0. IEEE Transactions on Software Engineering, PP, 99 (2020), 1–1.
[35]
Sunny Wong, Yuanfang Cai, Giuseppe Valetto, Georgi Simeonov, and Kanwarpreet Sethi. 2009. Design rule hierarchies and parallelism in software development tasks. In Proceedings of the 2009 IEEE/ACM International Conference on Automated Software Engineering. 197–208.
[36]
Sihan Xu, Aishwarya Sivaraman, Siau-Cheng Khoo, and Jing Xu. 2017. Gems: An extract method refactoring recommender. In 2017 IEEE 28th International Symposium on Software Reliability Engineering (ISSRE). 24–34.
[37]
Yutong Zhao, Lu Xiao, Xiao Wang, Zhifei Chen, Bihuan Chen, and Yang Liu. 2020. Butterfly space: An architectural approach for investigating performance issues. In 2020 IEEE International Conference on Software Architecture (ICSA). 202–213.

Index Terms

  1. HECS: A Hypergraph Learning-Based System for Detecting Extract Class Refactoring Opportunities

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Conferences
      ISSTA 2024: Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis
      September 2024
      1928 pages
      ISBN:9798400706127
      DOI:10.1145/3650212
      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

      Sponsors

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 11 September 2024

      Permissions

      Request permissions for this article.

      Check for updates

      Author Tags

      1. Extract Class Refactoring
      2. Hypergraph Neural Network

      Qualifiers

      • Research-article

      Funding Sources

      • National Natural Science Foundation of China
      • Proof of Concept Foundation of Xidian University Hangzhou Institute of Technology under Grant
      • Natural Science Foundation of Jiangsu Province

      Conference

      ISSTA '24
      Sponsor:

      Acceptance Rates

      Overall Acceptance Rate 58 of 213 submissions, 27%

      Upcoming Conference

      ISSTA '25

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • 0
        Total Citations
      • 95
        Total Downloads
      • Downloads (Last 12 months)95
      • Downloads (Last 6 weeks)27
      Reflects downloads up to 31 Dec 2024

      Other Metrics

      Citations

      View Options

      Login options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Media

      Figures

      Other

      Tables

      Share

      Share

      Share this Publication link

      Share on social media