4 ms·
Regarding variable names I think the correct answer is somewhere in the middle. There's such a thing as too short a variable name, and these days I see it more
by ohCh6zos 5y ago
Regarding variable names I think the correct answer is somewhere in the middle. There's such a thing as too short a variable name, and these days I see it more frequently than I see too verbose a variable name.
- cassianoleal 5y agoI believe the best answer is dependent on context. How short is too short? How large is too large? On a shallow for-loop, i and j as variable names is perfectly acceptable and probably desirable - it conveys their meaning in a very concise and familiar manner. On the other hand, if you're writing a function that's a little outside of your codebase's core areas it might make sense to name things a bit more verbosely and perhaps (the horror) add comments explaining in more detail what those data containers are supposed to hold.
- qbasic_forever 5y agoI would love to see the next generation of opinionated formatting tools perhaps use AI models to automatically set and enforce variable naming. Maybe even just some simple heuristics like iteration count variables are 3 characters or less, state values are nouns, etc. would be good enough. Please just completely automate and remove any and all bikeshedding around naming, much like we've done with formatting--it would probably remove 25% or more of all commentary on code reviews.