Descriptive Compound Identifier Names Improve Source Code Comprehension

Reading and understanding source code is a major task in software development. Code comprehension depends on the quality of code, which is impacted by code structure and identifier naming. In this paper we empirically investigated whether longer but more descriptive identifier names improve code comprehension compared to short names, as they represent useful information in more detail. In a web-based study 88 Java developers were asked to locate a semantic defect in source code snippets. With descriptive identifier names, developers spent more time in the lines of code before the actual defect occurred and changed their reading direction less often, finding the semantic defect about 14% faster than with shorter but less descriptive identifier names. These effects disappeared when developers searched for a syntax error, i.e., when no in-depth understanding of the code was required. Interestingly, the style of identifier names had a clear impact on program comprehension for more experienced developers but not for less experienced developers.

[1]  Iris Vessey,et al.  Research Report - The Relevance of Application Domain Knowledge: The Case of Computer Program Comprehension , 1995, Inf. Syst. Res..

[2]  David W. Binkley,et al.  To camelcase or under_score , 2009, 2009 IEEE 17th International Conference on Program Comprehension.

[3]  Ben Shneiderman,et al.  Syntactic/semantic interactions in programmer behavior: A model and experimental results , 1979, International Journal of Computer & Information Sciences.

[4]  David W. Binkley,et al.  Identifier length and limited programmer memory , 2009, Sci. Comput. Program..

[5]  Robert C. Martin Clean Code - a Handbook of Agile Software Craftsmanship , 2008 .

[6]  A. Baddeley The episodic buffer: a new component of working memory? , 2000, Trends in Cognitive Sciences.

[7]  Markus Pizka,et al.  Concise and consistent naming , 2005, 13th International Workshop on Program Comprehension (IWPC'05).

[8]  Kim Marriott,et al.  A tool for tracking visual attention: The Restricted Focus Viewer , 2003, Behavior research methods, instruments, & computers : a journal of the Psychonomic Society, Inc.

[9]  Sousuke Amasaki,et al.  Local Variables with Compound Names and Comments as Signs of Fault-Prone Java Methods , 2016, QuASoQ/TDA@APSEC.

[10]  A. Baddeley Working Memory, Thought, and Action , 2007 .

[11]  P. Carpenter,et al.  Individual differences in working memory and reading , 1980 .

[12]  Phillip Anthony Relf,et al.  Achieving Software Quality through Source Code Readability , 2004 .

[13]  Janet Siegmund,et al.  Shorter identifier names take longer to comprehend , 2017, 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER).

[14]  Jacob Cohen Statistical Power Analysis for the Behavioral Sciences , 1969, The SAGE Encyclopedia of Research Design.

[15]  Dawn J. Lawrie,et al.  The impact of identifier style on effort and comprehension , 2012, Empirical Software Engineering.

[16]  David W. Binkley,et al.  What’s in a Name? A Study of Identifiers , 2006, 14th IEEE International Conference on Program Comprehension (ICPC'06).

[17]  Jonathan I. Maletic,et al.  An Eye Tracking Study on camelCase and under_score Identifier Styles , 2010, 2010 IEEE 18th International Conference on Program Comprehension.

[18]  A. Baddeley,et al.  Word length and the structure of short-term memory , 1975 .

[19]  Yijun Yu,et al.  Exploring the Influence of Identifier Names on Code Quality: An Empirical Study , 2010, 2010 14th European Conference on Software Maintenance and Reengineering.

[20]  Robert H. Logie,et al.  Components of fluent reading , 1985 .

[21]  Eric J. Evans,et al.  Domain-driven design , 2003 .

[22]  Lori Lalonde,et al.  Domain-Driven Design , 2015 .

[23]  Isabel Evans,et al.  Achieving Software Quality through Teamwork , 2004 .

[24]  Andrew Begel,et al.  Cognitive Perspectives on the Role of Naming in Computer Programs , 2006, PPIG.

[25]  Yijun Yu,et al.  Relating Identifier Naming Flaws and Code Quality: An Empirical Study , 2009, 2009 16th Working Conference on Reverse Engineering.

[26]  David W. Binkley,et al.  Effective identifier names for comprehension and memory , 2007, Innovations in Systems and Software Engineering.

[27]  Ruven E. Brooks,et al.  Towards a Theory of the Comprehension of Computer Programs , 1983, Int. J. Man Mach. Stud..