6 ms·
> I’m glad we now live in a futuristic utopia where keyboard farts like p, idxcrpm, and x3 are rare. Perhaps it's the old "fart" in me, but these seem pretty c
by falcolas 10y ago
> I’m glad we now live in a futuristic utopia where keyboard farts like p, idxcrpm, and x3 are rare.
Perhaps it's the old "fart" in me, but these seem pretty clear.
p: a throwaway pointer, indicating that I'm probably in a C style for loop over an array.
idxcrpm: and index into crpm. What is 'crpm'? Dunno - what is 'window'?
x3: The third, distinct, x value. I see such variables used frequently in spatial algorithm implementations, where 'x' has distinct meaning.
It's more about knowing the idioms of the code you're in than some overarching rule of law.
- gilgoomesh 10y agoEven if "crpm" is a contextually known entity, I'd consider "idxcrpm" a terrible identifier. a) it's two words without a clear boundary – "idx_crpm" would be better (or idxCrpm if your project uses camelCase) b) it's an unnecessary abbreviation – "index" is only two chars longer than "idx" and legibility trumps raw brevity c) it's grammatically incorrect (without the "into" preposition that you used), hindering legibility – gramatically correct would be "crpm_index" (or crpmIndex)
- cessor 10y agoCode using single letter variable names and abbreviations makes people up to 15% slower at understanding code [1, 2]. Of course it is possible to determine - bottom up - what a variable is supposed to do or that p is short for pointer, it still slows others down because it requires them to perform mental mapping. This effect, of course, depends on experience. If you write your vars like this all the time your penalty won't be as big. [1] Influence of identifier length and semantics on the comprehensibility of source code, https://github.com/cessor/bachelor-thesis https://github.com/cessor/bachelor-thesis [2] Much shorter version published in https://fg-sre.gi.de/fileadmin/gliederungen/fg-sre/wsre2016/WSRE-2016-Proceedings-2.pdf https://fg-sre.gi.de/fileadmin/gliederungen/fg-sre/wsre2016/...
- abecedarius 10y agoUpvoted, but I'll add that I'm surprised at how small you found the effect of naming things a,b,c,... with no mnemonics at all. (I skimmed the shorter paper.)
- munificent 10y ago> idxcrpm: and index into crpm. What is 'crpm'? Are you sure it's not an ID for an XCRPM? :)