4 ms·
Using one letter variables and the such is excusable if you are new to programming and don't know better or if you use it in such a local context that the short
by atoav 2y ago
Using one letter variables and the such is excusable if you are new to programming and don't know better or if you use it in such a local context that the short length helps readability or if it is a "known" short variable like i or some sort of speaking short variable like db.
I like to think of myself as a good programmer, but whenever I encounter code where I have to figure out what "x" means, when it could have been a speaking variable like "accumulative_duration_ms" I feel like someone is trying to be clever.
I see using auto in a similar light. Explicit return types are good. In fact there's a trend to retrofit typing into languages that don't have it. You showing me that you value not thinking about the return type over specifying explicit return types is a red flag to me.
If we as programmers should value anything, it is the time and mental resources of the person who has to read our code in the future — very often that person is going to be you, yourself.
- lupusreal 2y agoI'm okay with x, but only x. Naming things can be hard so you get one freebie, but only one, so you better figure out a proper name for everything else after you use x.