2 ms·
Grep says the variable name "data" occurs about 80 times in the program I'm working on. I used to prefer descriptiveVariableNames, but as my programs have gott
by gruseom 15y ago
Grep says the variable name "data" occurs about 80 times in the program I'm working on.
I used to prefer descriptiveVariableNames, but as my programs have gotten shorter, my variable names have gotten much shorter. I found that longVariableNames were starting to overwhelm everything else and obscure the shape of the code. They were still communicating theIntentOfTheVariable like they always did, but in a way that felt less helpful and more like lexical noise.
Code shape communicates meaning through a different channel than variable names do. As code gets less verbose, its shape emerges more and more, that channel becomes more and more informative, and one begins to use shorter names so as not to drown it out.
This is very different than verbose programs written in verbose languages. There, descriptiveVariableNames don't take up an unseemly amount of space relative to everything else. The shape of the code is less meaningful because you can't see the forest for the trees. And you're far more dependent on intentionClarifyingNames to orient yourself in that forest.
This is why programs written in concise languages look absurdly cryptic to people who haven't spent time in that language's world. The markers of meaning they're used to relying on are missing, and their eyes haven't adjusted to the meaning that is there. The program may have been crafted to maximize overall meaning across several channels, but one needs time and practice to get what those channels are. And the tradeoffs are probably different in each language.