Tip: When naming a variable that stores a list, avoid needless suffixes


Tip: When naming a variable that stores a list, avoid needless suffixes.

Avoid:
🚫userData
🚫userList
🚫userArray
🚫userItems

Instead, keep it simple. Just use a plural noun:
✅users
I generally prefer code that reads like we speak.

Nobody looks at a long line and says "woah, that's a big customerList".

They'd say "That's a long line".

So, I might name the array customerLine or customerQueue. But if it's the only list, I might simply name it "customers".

View original on X