How Developers Extract Functions: An Experiment

09/02/2022
by   Alexey Braver, et al.
0

Creating functions is at the center of writing computer programs. But there has been little empirical research on how this is done and what are the considerations that developers use. We design an experiment in which we can compare the decisions made by multiple developers under exactly the same conditions. The experiment is based on taking existing production code, "flattening" it into a single monolithic function, and then charging developers with the task of refactoring it to achieve a better design by extracting functions. The results indicate that developers tend to extract functions based on structural cues, such as 'if' or 'try' blocks. And while there are significant correlations between the refactorings performed by different developers, there are also significant differences in the magnitude of refactoring done. For example, the number of functions that were extracted was between 3 and 10, and the amount of code extracted into functions ranged from 37

READ FULL TEXT

page 6

page 7

research
04/16/2020

Results from a replicated experiment on the affective reactions of novice developers when applying test-driven development

Test-driven Development (TDD) is an incremental approach to software dev...
research
07/20/2023

Empirical Evaluation of a Live Environment for Extract Method Refactoring

Complex software can be hard to read, adapt, and maintain. Refactoring i...
research
10/26/2020

How We Refactor and How We Document it? On the Use of Supervised Machine Learning Algorithms to Classify Refactoring Documentation

Refactoring is the art of improving the design of a system without alter...
research
04/18/2023

Developers' Visuo-spatial Mental Model and Program Comprehension

Previous works from research and industry have proposed a spatial repres...
research
07/15/2021

One Thousand and One Stories: A Large-Scale Survey of Software Refactoring

Despite the availability of refactoring as a feature in popular IDEs, re...
research
07/09/2020

RulePad: Interactive Authoring of Checkable Design Rules

Good documentation offers the promise of enabling developers to easily u...
research
08/12/2016

Coz: Finding Code that Counts with Causal Profiling

Improving performance is a central concern for software developers. To l...

Please sign up or login with your details

Forgot password? Click here to reset