I searched the forum, but I couldn't find the answers why it should be avoided, only why it's not a silver bullet. So I don't think this question is a duplicate.
Is there a VALID reason why I should unlearn Systems Hungarian I'm used to?
So far I see the following benefits in using it:
- Consistent variable naming
- You see type without searching (intellisense is dead/indexing half of the time, so it's still a valid reason)
- Semantics can still be packed into second part of the name
And following downsides:
- It annoys some people (no idea why)
- If type is changed, the type might not match the naming of the variable (I don't think it's valid reason, types are changed rarely, and you have "rename all")
So why:
vector<string> vecCityNames;
wstring strCity = L"abc";
//more code here
vecCityNames.push_back(strCity);
is worse than:
vector<string> cityNames;
wstring city = L"abc";
//more code here
cityNames.push_back(city);//Are we pushing back int on a queue? Float on a stack? Something else?
vectCityNames
bevectStringCityNames
so much for your consistent argument, and this "question" is more of a rant than anything, you have your mind made up, this should be closed.cityNames.push_back(city)
is pretty clear. It is a list of city names and you are adding one.