Supporting single responsibility through automated extract method refactoring

05/05/2023
by   Alireza Ardalani, et al.
0

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 three real-world projects. On average, our experiments demonstrate at least a 29.6 improvement in precision and a 12.1 refactoring opportunities compared to the state-of-the-art approaches. Furthermore, our tool improves method-level cohesion metrics by an average of 20 proposed approach in extracting methods with a single responsibility.

READ FULL TEXT
research
01/04/2023

Robust Surface Reconstruction from Orthogonal Slices

The surface reconstruction problem from sets of planar parallel slices r...
research
05/09/2019

DSAF: Dynamic Slice Allocation Framework for 5G Core Network

Network slicing is a key to supporting different quality-of-service requ...
research
01/03/2022

Freeway to Memory Level Parallelism in Slice-Out-of-Order Cores

Exploiting memory level parallelism (MLP) is crucial to hide long memory...
research
06/04/2021

Learning Slice-Aware Representations with Mixture of Attentions

Real-world machine learning systems are achieving remarkable performance...
research
01/29/2019

Reconstruction of 3D Porous Media From 2D Slices

We propose a novel deep learning architecture for three-dimensional poro...
research
03/13/2019

SymPas: Symbolic Program Slicing

Program slicing is a technique for simplifying programs by focusing on s...
research
09/19/2019

Slices of Attention in Asynchronous Video Job Interviews

The impact of non verbal behaviour in a hiring decision remains an open ...

Please sign up or login with your details

Forgot password? Click here to reset