Descriptive Compound Identifier Names Improve Source Code Comprehension
Reading and understanding source code is a major task in soft- ware development. Code comprehension depends on the quality of code, which is impacted by code structure and identifier nam- ing. 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 descrip- tive 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 ef- fects disappeared when developers searched for a syntax error, i.e., when no in-depth understanding of the code was required. Interest- ingly, the style of identifier names had a clear impact on program comprehension for more experienced developers but not for less experienced developers.