Live data from Hacker News

Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”

dave.cheney.net

31–33 of 33 posts

Re: Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”

#31
post #11

"Users": sounds like an array to me "UsersMap": doesn't add much value, what are you mapping? "UsersById": now this is my style

That's good style. The important thing you will get out of the map is at the front of the variable name, and there's a less important little qualifier "byId" to help you understand how the data is structured.

Re: Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”

#33
Firstly, I have known several people to name their animals some variation of their type, but barring that.

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.

Post reply on HN