EM-Assist: Safe Automated ExtractMethod Refactoring with LLMs
Fuente:
arXiv
Gespeichert in:
| Hauptverfasser: | , , , , , , , |
|---|---|
| Format: | Preprint |
| Veröffentlicht: |
2024
|
| Schlagworte: | |
| Online-Zugang: | |
| Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
| _version_ | 1866911895486726144 |
|---|---|
| author | Pomian, Dorin Bellur, Abhiram Dilhara, Malinda Kurbatova, Zarina Bogomolov, Egor Sokolov, Andrey Bryksin, Timofey Dig, Danny |
| author_facet | Pomian, Dorin Bellur, Abhiram Dilhara, Malinda Kurbatova, Zarina Bogomolov, Egor Sokolov, Andrey Bryksin, Timofey Dig, Danny |
| contents | Excessively long methods, loaded with multiple responsibilities, are challenging to understand, debug, reuse, and maintain. The solution lies in the widely recognized Extract Method refactoring. While the application of this refactoring is supported in modern IDEs, recommending which code fragments to extract has been the topic of many research tools. However, they often struggle to replicate real-world developer practices, resulting in recommendations that do not align with what a human developer would do in real life. To address this issue, we introduce EM-Assist, an IntelliJ IDEA plugin that uses LLMs to generate refactoring suggestions and subsequently validates, enhances, and ranks them. Finally, EM-Assist uses the IntelliJ IDE to apply the user-selected recommendation. In our extensive evaluation of 1,752 real-world refactorings that actually took place in open-source projects, EM-Assist's recall rate was 53.4% among its top-5 recommendations, compared to 39.4% for the previous best-in-class tool that relies solely on static analysis. Moreover, we conducted a usability survey with 18 industrial developers and 94.4% gave a positive rating. |
| format | Preprint |
| id |
arxiv_https___arxiv_org_abs_2405_20551 |
| institution | arXiv |
| publishDate | 2024 |
| record_format | arxiv |
| spellingShingle | EM-Assist: Safe Automated ExtractMethod Refactoring with LLMs Pomian, Dorin Bellur, Abhiram Dilhara, Malinda Kurbatova, Zarina Bogomolov, Egor Sokolov, Andrey Bryksin, Timofey Dig, Danny Software Engineering Human-Computer Interaction Machine Learning Programming Languages Excessively long methods, loaded with multiple responsibilities, are challenging to understand, debug, reuse, and maintain. The solution lies in the widely recognized Extract Method refactoring. While the application of this refactoring is supported in modern IDEs, recommending which code fragments to extract has been the topic of many research tools. However, they often struggle to replicate real-world developer practices, resulting in recommendations that do not align with what a human developer would do in real life. To address this issue, we introduce EM-Assist, an IntelliJ IDEA plugin that uses LLMs to generate refactoring suggestions and subsequently validates, enhances, and ranks them. Finally, EM-Assist uses the IntelliJ IDE to apply the user-selected recommendation. In our extensive evaluation of 1,752 real-world refactorings that actually took place in open-source projects, EM-Assist's recall rate was 53.4% among its top-5 recommendations, compared to 39.4% for the previous best-in-class tool that relies solely on static analysis. Moreover, we conducted a usability survey with 18 industrial developers and 94.4% gave a positive rating. |
| title | EM-Assist: Safe Automated ExtractMethod Refactoring with LLMs |
| topic | Software Engineering Human-Computer Interaction Machine Learning Programming Languages |
| url | https://arxiv.org/abs/2405.20551 |