An Eye Tracking Study on camelCase and under_score Identifier Styles
cs.kent.edu
cs.kent.edu
phrase: "full pathname"
identifiers: fill_pathname, full_mathname, full_pathnum, full_pathname
From the conclusions section: "Although, no difference was found between identifier styles with respect to accuracy, results indicate a significant improvement in time and lower visual effort with the underscore style. The interaction of Experience with Style indicates that novices benefit twice as much with respect to time, with the underscore style. This implies that with experience or training, the performance difference between styles is reduced. These results add to the findings of Binkley et al.’s study"
So, finding the correct identifier was just as likely regardless of style but the correct identifier was found faster if it was using underscores as opposed to camelCase.
I think the underscores acted as "whitespace" in this study which in my experience is the most important factor in how quickly you can visually parse code. However, from a subjective/aesthetic perspective, I still prefer using camelCase over underscores.
I consider the underscore and capitalization as part of the identifier, and _want_ to be able to distinguish the (most likely) typo "full pathname" from the desired identifier. Trying their example, most of my time was spent rescanning to find "none of the above", then rereading the directions.
Suggested alternative that I think would be a better study:
Which of the following is the same as "fullPathname":
1) "fullpathname"
2) "fullpathname"
3) "FullPathname"
4) "fullPathname"
5) None of the above
Which of the above is the same as "full_pathname": 1) "Full_Pathname"
2) "Full Pathname"
3) "full_pathname"
4) "full pathname"
5) None of the aboveI guess it's good we've got that established, at least.