3 ms·
Studies show CamelCase is easier to type, which is what the book references. But, studies also show that snake_case is easier to read. Code will be read more t
by jpcfl 5y ago
Studies show CamelCase is easier to type, which is what the book references. But, studies also show that snake_case is easier to read.
Code will be read more than it will be written, so it should be optimized for the reader.
- edent 5y agoThe study referenced - https://ieeexplore.ieee.org/abstract/document/5090039 https://ieeexplore.ieee.org/abstract/document/5090039 - says that coders and non-coders find CamelCase easier to read. But I'm eager to find counter examples.
- gls2ro 5y agoI cannot access the study, but I find it odd that they say in abstract: > Results indicate that camel casing leads to higher accuracy among all subjects regardless of training, and those trained in camel casing are able to recognize identifiers in the camel case style faster than identifiers in the underscore style. What does it mean: > those trained in camel casing are able to recognize identifiers in the camel case style faster than identifiers in the underscore style. It is not normal if you train in reading something => you are good in recognizing that things that you are trained than something else than you did not train for? If anyone has access to the study, how many among 135 are programmers that were trained in camel case and how many in snake case?
- drakmaniso 5y agoIt's more complicated than that. The study referenced in the book found that snake_case makes variables easier to read, but the whole program harder to parse (my guess is it's because of the visual similarity between the underscore and a space). With camelCase, it's the other way around. I vote for kebab-case, but I didn't find any study where it was included...
- _dain_ 5y agois it easier to type? I can give an objective reason why kebab-case may be easier to type: you don't have to press shift at any point.
- jodrellblank 5y agoThe spacebar is huge and under both thumbs, because you use it a lot. - is far away under one fourth finger or pinky, it's bad to type. Shifted letters are common. Seems like it should be shift+space inserts a variable-split-token and different editors can display it as a - _ or caps of the next character as desired. Like tab characters being configurable as a number of spaces.
- _dain_ 5y agoor just use Nim which is style-insensitive: case except for the first letter is ignored, as are underscores.