TY - GEN
T1 - ChatGPT for Code Refactoring
T2 - 35th IEEE International Conference on Collaborative Advances in Software and Computing, CASCON 2025
AU - Alomar, Eman Abdullah
AU - Xu, Luo
AU - Martinez, Sofia
AU - Peruma, Anthony
AU - Mkaouer, Mohamed Wiem
AU - Newman, Christian D.
AU - Ouni, Ali
N1 - Publisher Copyright:
© 2025 IEEE.
PY - 2025
Y1 - 2025
N2 - Large Language Models (LLMs), such as ChatGPT, have become widely popular and widely used in various software engineering tasks such as refactoring, testing, code review, and program comprehension. Although recent studies have examined the effectiveness of LLMs in recommending and suggesting refactoring, there is a limited understanding of how developers express their refactoring needs when interacting with ChatGPT. In this paper, our goal is to explore interactions related to refactoring between developers and ChatGPT to better understand how developers identify areas for improvement in code, and how ChatGPT addresses developers' needs. Our approach involves text mining 715 refactoring-related interactions from 29,778 ChatGPT prompts and responses, as well as the analysis of developers' explicit refactoring intentions. Our results reveal that (1) refactoring interactions between developers and ChatGPT encompass 25 themes including 'Quality', 'Objective', 'Testing', and 'Design', (2) ChatGPT's use of affirmation phrases such as 'certainly' regarding refactoring decisions, and apology phrases such as 'apologize' when resolving refactoring challenges, and (3) our refactoring prompt template enables developers to obtain concise, accurate, and satisfactory responses with minimal interactions. We envision our results enhancing researchers and practitioners understanding of how developers interact with LLMs during code refactoring.
AB - Large Language Models (LLMs), such as ChatGPT, have become widely popular and widely used in various software engineering tasks such as refactoring, testing, code review, and program comprehension. Although recent studies have examined the effectiveness of LLMs in recommending and suggesting refactoring, there is a limited understanding of how developers express their refactoring needs when interacting with ChatGPT. In this paper, our goal is to explore interactions related to refactoring between developers and ChatGPT to better understand how developers identify areas for improvement in code, and how ChatGPT addresses developers' needs. Our approach involves text mining 715 refactoring-related interactions from 29,778 ChatGPT prompts and responses, as well as the analysis of developers' explicit refactoring intentions. Our results reveal that (1) refactoring interactions between developers and ChatGPT encompass 25 themes including 'Quality', 'Objective', 'Testing', and 'Design', (2) ChatGPT's use of affirmation phrases such as 'certainly' regarding refactoring decisions, and apology phrases such as 'apologize' when resolving refactoring challenges, and (3) our refactoring prompt template enables developers to obtain concise, accurate, and satisfactory responses with minimal interactions. We envision our results enhancing researchers and practitioners understanding of how developers interact with LLMs during code refactoring.
UR - https://www.scopus.com/pages/publications/105033222420
U2 - 10.1109/CASCON66301.2025.00068
DO - 10.1109/CASCON66301.2025.00068
M3 - Contribution to conference proceedings
AN - SCOPUS:105033222420
T3 - Proceedings - 2025 IEEE International Conference on Collaborative Advances in Software and Computing, CASCON 2025
SP - 389
EP - 398
BT - Proceedings - 2025 IEEE International Conference on Collaborative Advances in Software and Computing, CASCON 2025
A2 - Muller, Hausi A.
A2 - Zou, Ying
A2 - Bradbury, Jeremy
A2 - Stroulia, Eleni
PB - Institute of Electrical and Electronics Engineers Inc.
Y2 - 10 November 2025 through 13 November 2025
ER -