Abstract
It is generally accepted that variables with a narrow syntactic scope can have short names, whereas variables with a broad scope require more informative longer names. We study how names are given in practice, using a dataset of nearly 640 thousand variable names from Java methods, recently introduced by Aman et al. We extend their original analysis by using a finer division of scopes into ranges. We find that indeed variables with broader scope tend to be slightly longer and to include more words. There is also a progression of changes in name structures, with fewer single-letter names and more compound names as the scope increases. But the biggest differences occur at the low-scope end, not the high-scope end. In addition, we present more evidence that words of 6 letters or more are often abbreviated, but this is not affected by scope. Finally, we also analyze the distribution of popularity of names and of words in names, and show that single letter names are much more varied and common than usually thought, even when the variables have a broad scope.
Original language | English |
---|---|
Title of host publication | Proceedings - 2023 IEEE/ACM 31st International Conference on Program Comprehension, ICPC 2023 |
Publisher | IEEE Computer Society |
Pages | 227-236 |
Number of pages | 10 |
ISBN (Electronic) | 9798350337501 |
DOIs | |
State | Published - 2023 |
Event | 31st IEEE/ACM International Conference on Program Comprehension, ICPC 2023 - Melbourne, Australia Duration: 15 May 2023 → 16 May 2023 |
Publication series
Name | IEEE International Conference on Program Comprehension |
---|---|
Volume | 2023-May |
Conference
Conference | 31st IEEE/ACM International Conference on Program Comprehension, ICPC 2023 |
---|---|
Country/Territory | Australia |
City | Melbourne |
Period | 15/05/23 → 16/05/23 |
Bibliographical note
Publisher Copyright:© 2023 IEEE.
Keywords
- name length
- variable name
- variable scope