"UsersMap": doesn't add much value, what are you mapping?
"UsersById": now this is my style
11–20 of 33 posts
"UsersMap": doesn't add much value, what are you mapping?
"UsersById": now this is my style
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.)
"Users": sounds like an array to me "UsersMap": doesn't add much value, what are you mapping? "UsersById": now this is my style
"If there is more that one *Config in scope at any one time, calling them config1 and config2 is less descriptive than calling them original and updated ." The correct naming is of course "originalConfig" and "updatedConfig".
Yeah, just 'original' and 'updated' are probably a better choice.
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 use…
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.
犬 = Inu = Dog