arrow
返回

Supporting single responsibility through automated extract method refactoring

delete2023-12-22
delete0
PRE
AI
A
Alireza Ardalani
S
Saeed Parsa *
M
Morteza Zakeri‐Nasrabadi
A
Alexander Chatzigeorgiou
DOI:10.1007/s10664-023-10427-3delete
delete原文链接
delete原文求助
delete分享
delete收藏
摘要

摘要

En 中文
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 preservation are made. The proposed method has been evaluated on the GEMS extract method refactoring benchmark and three real-world projects. On average, our experiments demonstrate at least a 29.6% improvement in precision and a 12.1% improvement in the recall of uncovering refactoring opportunities compared to the state-of-the-art approaches. Furthermore, our tool improves method-level cohesion metrics by an average of 20% after refactoring. Experimental results confirm the applicability of the proposed approach in extracting methods with a single responsibility.
Keyword:
Extract method refactoring
Single responsibility
Program slicing
Long method
Output instructions

期刊

Empirical Software Engineering 封面图
Empirical Software Engineering
IF:
3.6
论文数:
2.0K
被引数:
5.3K

机构

U
University of Macedonia
学者数:
832
论文数: 920
被引数: 536
引用论文

引用论文

Analysis of genetic variability in various tissue culture-derived lemon plant populations using RAPD and flow cytometry
err2007-09-08
err0
PREAI
errV. Orbović; M. Ćalović; Z. Viloria; B. Nielsen; F. G. Gmitter; W. S. Castle; J. W. Grosser
err分享
err收藏
perspective: The keystone species concept: a critical appraisal
err2012-09-28
err0
errOAAI
errHenry Eden W Cottee-Jones; Robert J. Whittaker
err分享
err收藏
err分享
err收藏
err分享
err收藏
Identifying Extract Method Refactoring Opportunities Based on Functional Relevance
err2017-10-01
err27
errOAAI
errCharalampidou, Sofia; Ampatzoglou, Apostolos; Chatzigeorgiou, Alexander; Gkortzis, Antonios; Avgeriou, Paris
err分享
err收藏
Re-Cloning the N27 Dopamine Cell Line to Improve a Cell Culture Model of Parkinson's Disease
err2016-08-11
err0
errOAAI
errLu Gao; Wenbo Zhou; Breanna Symmes; Curt R. Freed
err分享
err收藏
The amazing world of self-organized Ge quantum dots for Si photonics on SiN platforms
err2023-01-17
err0
errOAAI
errPo-Yu Hong; Chin-Hsuan Lin; I.-Hsiang Wang; Yu-Ju Chiu; Bing-Ju Lee; Jiun-Chi Kao; Chun-Hao Huang; Horng-Chih Lin; Thomas George; Pei-Wen Li
err分享
err收藏
学者 查看更多内容