4 ms·
I highly disagree with this advice. I understand the intent of the advice, I just think the proposed rule (in the body of the post) is a bad implementation of t
by munchbunny 8y ago
I highly disagree with this advice. I understand the intent of the advice, I just think the proposed rule (in the body of the post) is a bad implementation of the intent because it is overly general.
Name your variable in a way that makes as clear as possible what the variable is used for.
He uses the example of "userMap". I think its mistake is not saying what the mapping is for. Names to users? Phone numbers to users? Emails to users? Its mistake is not calling it a map, which tells the reader that a variable behaves as a mapping. (And if it's not actually a map, then don't call it a map.)
- drdeadringer 8y ago> Name your variable in a way that makes as clear as possible what the variable is used for. This is my consideration as well. It's like "documentation for free" or "commenting without comments". When I get hit by a bus tomorrow, you will be able to look at my variables and have an easy, viable clue about what is going on. Reading my mind will be that much easier when figuring my code.