|
|
|
|
|
by nerdzero
4710 days ago
|
|
This is really interesting. Nice find. Here's a very brief summary: Participants were shown a few words and then four different identifiers, one of which matched the words and three of which did not. The example in the paper is: 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":
Which of the above is the same as "full_pathname":