3 ms·
If you're talking about a small, quickly-written, one-off piece of code, then I think truncated variable names are OK. If the code is anything that anyone else
by pavas 7y ago
If you're talking about a small, quickly-written, one-off piece of code, then I think truncated variable names are OK.
If the code is anything that anyone else (including future you) will have to read, or a part of a larger system, then descriptive variable names are best.
I can't count the number of times I've dropped into some source code with variable names that didn't mean anything and with no comments describing what they mean.
- JustSomeNobody 7y agoIf one understands anything at all about a cpu, then pc, sp, a mean something instantly.
- Aachen 7y agoAgree on those, but t and tk can mean anything. We can symbolize everything and, as someone else argued, once you know tk is token you can just read it, but replacing variable names with the shortest possible names is still called obfuscation for a reason. I personally also hate the Java (and to a lesser extent, C#) custom to write MemoryLocationRepresentation when you can say pointer, but there is certainly a middle ground. Token is 5 characters, not 30.