Today I am readying a paper that describes in detail an interesting study in which 120 computer science students rated 100 small code snippets (7.7 lines on average) from 1 to 5 according to their readability. The dataset and the tool used for the study are available. Some of the results of this study are that:
- “… humans agree significantly on what readable code looks like, but not to an overwhelming extent.”
- “factors like ‘average line length’ and ‘average number of identifiers per line’ are very important to readability”.
- “… ‘average identifier length’ is not, in itself, a very predictive factor; neither are if constructs, loops, or comparison operators.”