Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”
dave.cheney.net
dave.cheney.net
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.)
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.
"UsersMap": doesn't add much value, what are you mapping?
"UsersById": now this is my style
My cat has a name, but I just call him "cat" most of the time.
The point being - if the name is not ambiguous, it's fine.
The correct naming is of course "originalConfig" and "updatedConfig".
Yeah, just 'original' and 'updated' are probably a better choice.
I also inherited a bunch of circa-2005 ColdFusion with aptly named variables in CamelCase which are much easier to understand.
varUsersTableID > pointer*Freya any day of the week.
this is hilarious.
“He’s the only one. He knows I’m talking to him.”
I would if I could not tell just by looking at them what species they are (and thus what I can do with them, what to feed them, etc) among 200 other animals in my house.
To torture the metaphor a bit more, of course I'd eventually remember which one is which because they live with me. A better metaphor is the feral cat that shows up on my doorstep once a week looking for a handout. I've slept since then, what are you again?
I see it as a courtesy to myself than those that come after me to provide relevant context to a variable name. If the type in the scope of the variable is meaningful to its use then I will include it.
Good or bad code tells me what it does, rarely does it tell me what its supposed to do.
犬 = Inu = Dog