Don't add unneeded context
If your class or object name tells you something, don't repeat that in your variable name.
☑️ Topic: General
☑️ Idea: If your class or object name tells you something, don't repeat that in your variable name.
☑️ Benefit: Readability. Code is easier to read if there is no unnecessary information bloating it.
☑️ Guideline: Shorter names are generally better than longer ones, so long as they are clear. Only add things if they provide real value to a name.
// BAD
const Car = {
carMake: "Honda",
carModel: "Accord",
carColor: "Blue",
}
// GOOD
const Car = {
make: "Honda",
model: "Accord",
color: "Blue",
}
// BAD
const Car = {
carMake: "Honda",
carModel: "Accord",
carColor: "Blue",
}
// GOOD
const Car = {
make: "Honda",
model: "Accord",
color: "Blue",
}