A Large-Scale Investigation of Local Variable Names in Java Programs: Is Longer Name Better for Broader Scope Variable?

QUATIC(2021)

Cited 3|Views0
No score
Abstract
Variables are fundamental elements of software, and their names hold vital clues to comprehending the source code. It is ideal that a variable’s name should be informative that anyone quickly understands its role. When a variable’s scope gets broader, the demand for such an informative name becomes higher. Although the standard naming conventions provide valuable guidelines for naming variables, there is a lack of concrete and quantitative criteria regarding a better name. That challenge in naming variables is the motivation of the quantitative investigation conducted in this paper. The investigation collects 637,077 local variables from 1,000 open-source Java projects to get a detailed view of the variable naming trend. The data analysis reveals frequently-used terms for variable names, the naming styles, and the length of names when the variable scopes are broad. The results showed that developers prefer to use fully spelled English words or compounded names for broad-scope variables, but they tend to avoid long names; Developers often use simple words or abbreviations shorter than seven or eight characters.
More
Translated text
Key words
Variable name,Variable scope,Quantitative investigation
AI Read Science
Must-Reading Tree
Example
Generate MRT to find the research sequence of this paper
Chat Paper
Summary is being generated by the instructions you defined