Meaningful Identifier Names: The Case of Single-Letter Variables

Gal Beniamini, Sarah Gingichashvili, Alon Klein Orbach, Dror G. Feitelson

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

44 Scopus citations

Abstract

It is widely accepted that variable names in computer programs should be meaningful, and that this aids program comprehension. 'Meaningful' is commonly interpreted as favoring long descriptive names. However, there is at least some use of short and even single-letter names: using 'i' in loops is very common, and we show (by extracting variable names from 1000 popular github projects in 5 languages) that some other letters are also widely used. In addition, controlled experiments with different versions of the same functions (specifically, different variable names) failed to show significant differences in ability to modify the code. Finally, an online survey showed that certain letters are strongly associated with certain types and meanings. This implies that a single letter can in fact convey meaning. The conclusion from all this is that single letter variables can indeed be used beneficially in certain cases, leading to more concise code.

Original languageEnglish
Title of host publicationProceedings - 2017 IEEE 25th International Conference on Program Comprehension, ICPC 2017
PublisherIEEE Computer Society
Pages45-54
Number of pages10
ISBN (Electronic)9781538605356
DOIs
StatePublished - 28 Jun 2017
Event25th IEEE International Conference on Program Comprehension, ICPC 2017 - Buenos Aires, Argentina
Duration: 22 May 201723 May 2017

Publication series

NameIEEE International Conference on Program Comprehension

Conference

Conference25th IEEE International Conference on Program Comprehension, ICPC 2017
Country/TerritoryArgentina
CityBuenos Aires
Period22/05/1723/05/17

Bibliographical note

Publisher Copyright:
© 2017 IEEE.

Keywords

  • Program comprehension
  • meaningful identifier names
  • single-letter names

Fingerprint

Dive into the research topics of 'Meaningful Identifier Names: The Case of Single-Letter Variables'. Together they form a unique fingerprint.

Cite this