Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”
1–10 of 33 posts
Re: Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”
#2I once had a cat named "dog".
Re: Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”
#3I once had a cat named "dog".
Did it compile okay?
Re: Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”
#4I disagree. I don’t want to have to hunt around for the definition of users to know how to use it. Yes the compiler will throw an error, but that doesn’t help me when I’m typing code.
Re: Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”
#5Horrible advice unless you use an IDE which keeps track of variable types for you.
Re: Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”
#6"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".
Re: Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”
#7I once had a cat named "dog".
[deleted]
Re: Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”
#8I actually had a teacher whose cat was just “cat”.
“He’s the only one. He knows I’m talking to him.”
Re: Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”
#9Were my domestic pets actually amorphous blobs of text, damned straight I'd prefix or suffix their names with "dog" or "cat" just so I could keep them straight. "Honey, where's the header file for the blue one? Can't remember if it gets dog food or cat food."
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?
Re: Don't name your variables after types:you wouldn’t name your pets “dog” or “cat”
#10My first girlfriend named our cat named Kitty; my first spouse named our truck Trucky and wouldn't let me name our snake Fluffy. Sometimes my variable names reference types, but typically in dynamically typed languages. Didn't read past the title because it's wrong about me and wrong about my code