Supporting single responsibility through automated extract method refactoring
Alireza Ardalani, Saeed Parsa, Morteza Zakeri-Nasrabadi, Alexander, Chatzigeorgiou

TL;DR
This paper introduces a new backward slicing algorithm for refactoring long methods into smaller, single-responsibility methods, improving code quality and refactoring opportunity detection.
Contribution
The paper presents a novel backward slicing algorithm that refactors long methods into independent, single-responsibility methods, enhancing precision and code cohesion.
Findings
29.6% improvement in precision over state-of-the-art
12.1% improvement in recall of refactoring opportunities
20% increase in method-level cohesion metrics
Abstract
The responsibility of a method/function is to perform some desired computations and disseminate the results to its caller through various deliverables, including object fields and variables in output instructions. Based on this definition of responsibility, this paper offers a new algorithm to refactor long methods to those with a single responsibility. We propose a backward slicing algorithm to decompose a long method into slightly overlapping slices. The slices are computed for each output instruction, representing the outcome of a responsibility delegated to the method. The slices will be non-overlapping if the slicing criteria address the same output variable. The slices are further extracted as independent methods, invoked by the original method if certain behavioral preservations are made. The proposed method has been evaluated on the GEMS extract method refactoring benchmark and…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software Testing and Debugging Techniques · Scientific Computing and Data Management
