Linguistic Economy Applied to Programming Language Identifiers
- 1 University of St. Thomas, St. Paul, USA
- 2 Universität Würzburg, Würzburg, Germany
Abstract
Though many different readability metrics have been created, there still is no universal agreement defining readability of software source code. The lack of a clear agreement of source code readability has ramifications in many areas of the software development life-cycle, not least of which being software maintainability. We propose a measurement based on Linguistic Economy to bridge the gap between mathematical and behavioral aspects. Linguistic Economy describes efficiencies of speech and is generally applied to natural languages. In our study, we create a large corpus of words that are likely to be found in a programmer’s vocabulary, and a corpus of existing identifiers found in a collection of open-source projects. We perform a usage analysis to create a database from both of these corpora. Linguistic Economy suggests that words requiring less effort to speak are used more often than words requiring more effort. This concept is applied to measure how difficult program identifiers are to understand by extracting them from the program source and comparing their usage to the database. Through this process, we can identify source code that programmers find difficult to review. We validate our work using data from a survey where programmers identified unpleasant to review source files. The results indicate that source files identified as unpleasant to review source code have more linguistically complicated identifiers than pleasant programs.
- Deissenboeck, F. and Pizka, M. (2006) Concise and Consistent Naming. Soft-Ware Quality Journal, 14, 261-282. https://doi.org/10.1007/s11219-006-9219-1
- Zipf, G.K. (1949) Human Behavior and the Principle of Least Effort. Addison-Wesley Press, Boston.
- Martinet, A. (1955) économie des changements phonétiques. Francke, 396, 2-15.
- Duarte, M.J.P. (2007) El principio de economía lingüística. Pragma-Lingüística, 15-16, 166-178.
- Zipf, G.K. (1936) The Psychobiology of Language: An Introduction to Dynamic Philology. Houghton-Mifflin, Boston.
- Yu, S., Xu, C. and Liu, H. (2018) Zipf’s Law in 50 Languages: Its Structural Pattern, linguistic Interpretation, and Cognitive Motivation. https://arxiv.org/abs/1807.01855
- Zhang, H. (2008) Exploring Regularity in Source Code: Software Science and Zipf’s Law. 15th Working Conference on Reverse Engineering, Antwerp, 15-18 October 2008, 101-110. https://doi.org/10.1109/WCRE.2008.37
- Halstead, M.H., et al. (1977) Elements of Software Science. Elsevier, New York.
- David, L. and Seinfeld, J. (1991) Seinfeld the Red Dot Episode.
- Rozin, P. and Royzman, E.B. (2001) Negativity Bias, Negativity Dominance, and Contagion. Personality and Social Psychology Review, 5, 296-320. https://doi.org/10.1207/S15327957PSPR0504_2
- Darby, M., et al. (2008) Library Reading Program for Secondary esl Students. Access, 22, 9.
- Bryan, S. (2011) Extensive Reading, Narrow Reading and Second Language Learners: Implications for Libraries. The Australian Library Journal, 60, 113-122. https://doi.org/10.1080/00049670.2011.10722583
- Dorin, M. (2018) Coding for Inspections and Reviews. Proceedings of the 19th International Conference on Agile Software Development: Companion, Porto, May 2018, 1-3. https://doi.org/10.1145/3234152.3234159
- Dorin, M. and Montenegro, S. (2019) Eliminating Software Caused Mission Failures. 2019 IEEE Aerospace Conference, Big Sky, 2-9 March 2019, 1-4. https://doi.org/10.1109/AERO.2019.8741837
- Hauben, M. and Hauben, R. (1998) Netizens: On the History and Impact of Usenet and the Internet. First Monday, 3. https://doi.org/10.5210/fm.v3i7.605 https://journals.uic.edu/ojs/index.php/fm/ article/view/605
- GitHub. http://www.github.com