3 ms·
Shorter names aren't easier to read if you have several similar names used in close proximity. More characters can reduce the congruence and make it easier to d
by onion2k 4y ago
Shorter names aren't easier to read if you have several similar names used in close proximity. More characters can reduce the congruence and make it easier to differtiate between names.
I agree about fitting things onto one line though. It's usually better to break things up into to several short one line steps rather than have a long multi line statement.
- philipwhiuk 4y agoI tend to think length should be proportionate to broadness of usage within the file/project If it's used in lots of places, go for MAXIMUM_MONSTER_DENSITY_SCORE_MULTIPLIER If it's used in a single file/function, then maxDensityMultiplier might be okay. (You can infer the rest from context). If it's used in a very confined section, then multiplier. If it's a loop variable then, sure use m.
- ziml77 4y agoMore characters can make it harder to differentiate names. The longer the name is, the harder it is to see it as a single unit while reading. Also, if the long names cause many extra lines, it becomes easier to lose context from the extra distance one moves down the document while reading.
- Shorel 4y agoIf they all start with 'factory', sure. I would be a long name that doesn't add information that helps differentiate between different variables.