DEV Community

Discussion on: The Power of Variable Names

Collapse
 
moopet profile image
Ben Sinclair

I agree with most of the points here, but picked up on a couple of points:

I don't think that pointsRecord is a better variable name than maximumNumberOfPointsInModernOlympics because "record" doesn't imply the same thing as "maximum possible", and also because "record" is more usually used to convey the idea of a set of data.

Your last example says that you don't need to use "m_" as a member variable prefix anymore, but you immediately follow that with a list of "Standarized Prefixes" including "m_". I think that either you use a language where the convention includes metadata about the variable or you don't, and you go with what the rest of the world does.

Collapse
 
adillaumam profile image
Ahmad Adillaumam

First, thanks for the comment. I can agree with your first argument. pointsRecord does not fully represent maximumNumberOfPointsInModernOlympics. I will learn more about it. Regarding the m_ prefix, it is not recommended to use prefixes but in certain situations such as in the organization, prefixes may be needed and used with name conventions. I included an explanation of prefixes in the name convention section. I just realized that I'm converting C++ syntax to Javascript carelessly. At first, I meant it for intermezzo, but it seems misguided and misunderstood. Maybe I need to delete it or add a note. Thanks again for the comment, I appreciate it, and it helped me :)