Refactoring Loops in the Era of LLMs: A Comprehensive Study

-д хадгалсан:
Номзүйн дэлгэрэнгүй
-д хэвлэсэн:Future Internet vol. 17, no. 9 (2025), p. 418-445
Үндсэн зохиолч: Midolo Alessandro
Бусад зохиолчид: Tramontana Emiliano
Хэвлэсэн:
MDPI AG
Нөхцлүүд:
Онлайн хандалт:Citation/Abstract
Full Text + Graphics
Full Text - PDF
Шошгууд: Шошго нэмэх
Шошго байхгүй, Энэхүү баримтыг шошголох эхний хүн болох!

MARC

LEADER 00000nab a2200000uu 4500
001 3254515851
003 UK-CbPIL
022 |a 1999-5903 
024 7 |a 10.3390/fi17090418  |2 doi 
035 |a 3254515851 
045 2 |b d20250101  |b d20251231 
084 |a 231464  |2 nlm 
100 1 |a Midolo Alessandro 
245 1 |a Refactoring Loops in the Era of LLMs: A Comprehensive Study 
260 |b MDPI AG  |c 2025 
513 |a Journal Article 
520 3 |a Java 8 brought functional programming to the Java language and library, enabling more expressive and concise code to replace loops by using streams. Despite such advantages, for-loops remain prevalent in current codebases as the transition to the functional paradigm requires a significant shift in the developer mindset. Traditional approaches for assisting refactoring loops into streams check a set of strict preconditions to ensure correct transformation, hence limiting their applicability. Conversely, generative artificial intelligence (AI), particularly ChatGPT, is a promising tool for automating software engineering tasks, including refactoring. While prior studies examined ChatGPT’s assistance in various development contexts, none have specifically investigated its ability to refactor for-loops into streams. This paper addresses such a gap by evaluating ChatGPT’s effectiveness in transforming loops into streams. We analyzed 2132 loops extracted from four open-source GitHub repositories and classified them according to traditional refactoring templates and preconditions. We then tasked ChatGPT with the refactoring of such loops and evaluated the correctness and quality of the generated code. Our findings revealed that ChatGPT could successfully refactor many more loops than traditional approaches, although it struggled with complex control flows and implicit dependencies. This study provides new insights into the strengths and limitations of ChatGPT in loop-to-stream refactoring and outlines potential improvements for future AI-driven refactoring tools. 
653 |a Java 
653 |a Software development 
653 |a Investigations 
653 |a Functional programming 
653 |a Chatbots 
653 |a Generative artificial intelligence 
653 |a Large language models 
653 |a Software engineering 
653 |a Software 
653 |a Evaluation 
653 |a Efficiency 
653 |a Semantics 
653 |a Creeks & streams 
700 1 |a Tramontana Emiliano 
773 0 |t Future Internet  |g vol. 17, no. 9 (2025), p. 418-445 
786 0 |d ProQuest  |t ABI/INFORM Global 
856 4 1 |3 Citation/Abstract  |u https://www.proquest.com/docview/3254515851/abstract/embedded/H09TXR3UUZB2ISDL?source=fedsrch 
856 4 0 |3 Full Text + Graphics  |u https://www.proquest.com/docview/3254515851/fulltextwithgraphics/embedded/H09TXR3UUZB2ISDL?source=fedsrch 
856 4 0 |3 Full Text - PDF  |u https://www.proquest.com/docview/3254515851/fulltextPDF/embedded/H09TXR3UUZB2ISDL?source=fedsrch