2016-08-20

Meaningful Identifier Names Lead to a 20% Faster Detection of Defects

Researchers of the universities of Heidelberg and Passau showed in a controlled experiment that meaningful identifier names improve maintainability of source code in contrast to abbreviated or single letter identifiers.

For most practitioners, this fact should be nothing new, but the researchers give statistically significant results that “proof” that choosing meaningful words leads to a 20% faster detection of defects in source code, whereas single letters or abbreviations do not. They also found no statistically significant difference between the average time one needs to find a defect in source code with abbreviated identifiers and source code with single letter identifiers1.

The researchers recommend to use meaningful identifier names during development to save maintenance costs later on1.

However, from my practitioner's point of view, another aspect of identifier length is of relevance as well: the maximum length.
We generally observe that identifiers exceeding a subjective length limit are harder to read and that it takes longer time to get an idea of their semantic meaning.
Here, knowledge based on empirical data would also be very helpful to argue for certain minimum and maximum requirements for identifier length in code styles beyond personal preference.


  1. Hofmeister, J., Siegmund, J., Holt, D.V.: Influence of Identifier Length and Semantics on the Comprehensibility of Source Code. Softwaretechnik-Trends, volume 36, issue 2, pp. 47–48 (2016). http://pi.informatik.uni-siegen.de/gi/stt/36_2/01_Fachgruppenberichte/WSRE2016/WSRE2016_25_paper_6.pdf

No comments:

Post a Comment