3 ms·
It's the most elegant code, sure. But it also creates more work for me to read it, because I need to build up a mental map memorizing {letter => meaning, letter
by crazygringo 8y ago
It's the most elegant code, sure. But it also creates more work for me to read it, because I need to build up a mental map memorizing {letter => meaning, letter => meaning, ...}.
If you create a meaningful name, then that means I can understand the code more quickly with less effort, and save that mental effort for more productive tasks.
If you're programming professionally, why would you prefer greater elegance and conciseness... over less work? It feels like a harmful over-optimization.
- enriquto 8y agoYou do not need to memorize anything if your function fits in a single screen and you have less than 10 variables at the same time (which are good conventions as well).
- sethammons 8y agoRemembering 10 single letter mappings vs clear variable names sounds onerous.a, b, c, d, e, f, g, h, i, and j vs price, discount, coupon, item_description, item_id, ...
- enriquto 8y ago> Remembering 10 single letter mappings vs clear variable names sounds onerous Have you ever read an applied math book? They do not seem to have this problem. My point is that int d; // dimension_of_the_space is much better than int dimension_of_the_space; especially if the quantity appears inside many formulas.
- crazygringo 8y ago> Have you ever read an applied math book? They do not seem to have this problem. Working through an applied math book takes an entire semester with many, many hours of study, and you're expected to master the material inside out. Programmers generally do not have anything like the luxury of that kind of time, nor are they expected to reach that level of mastery with the codebase -- they need to quickly identify where changes need to be made, make them, ensure test coverage continues to be complete and passes, and move on to the next thing.