Large Language Model-Based Decomposition of Long Methods
Author:
Affiliation:

Clc Number:

TP311

Fund Project:

  • Article
  • |
  • Figures
  • |
  • Metrics
  • |
  • Reference
  • |
  • Related
  • |
  • Cited by
  • |
  • Materials
  • |
  • Comments
    Abstract:

    Long methods, as well as other categories of code smells, are preventing software applications from reaching their maximal readability, reusability, and maintainability. Consequently, automated detection and decomposition of long methods have been extensively studied. Although such approaches have significantly facilitated the decomposition, their solutions are often substantially different from the optimal ones. To this end, in this paper, we investigated the automatable portion of a publicly available dataset containing real-world long methods. Based on the findings from this investigation, we propose a method called Lsplitter, which utilizes large language models to automatically decompose long methods. For a given long method, Lsplitter employs heuristic rules and large language models to decompose the method into a series of shorter methods. However, large language models often result in the decomposition of similar methods. To address this, Lsplitter uses a location-based algorithm to merge physically contiguous and highly similar methods into a longer method. Finally, it ranks these candidate results. We conducted experiments on 2849 long methods from real-world Java projects. The experimental results show that Lsplitter improves the hit rate by 142% compared to traditional methods combined with modularity matrix, and by 7.6% compared to methods purely based on large language models.

    Reference
    Related
    Cited by
Get Citation

徐子懋,姜艳杰,张宇霞,刘辉.基于大语言模型的长方法分解.软件学报,2025,36(6):0

Copy
Share
Article Metrics
  • Abstract:
  • PDF:
  • HTML:
  • Cited by:
History
  • Received:August 26,2024
  • Revised:October 14,2024
  • Adopted:
  • Online: December 10,2024
  • Published:
You are the firstVisitors
Copyright: Institute of Software, Chinese Academy of Sciences Beijing ICP No. 05046678-4
Address:4# South Fourth Street, Zhong Guan Cun, Beijing 100190,Postal Code:100190
Phone:010-62562563 Fax:010-62562533 Email:jos@iscas.ac.cn
Technical Support:Beijing Qinyun Technology Development Co., Ltd.

Beijing Public Network Security No. 11040202500063