How to distinguish properties from constants if they both use PascalCasing for naming?
Posted
by Gishu
on Stack Overflow
See other posts from Stack Overflow
or by Gishu
Published on 2010-05-07T14:10:36Z
Indexed on
2010/05/07
14:18 UTC
Read the original article
Hit count: 253
As stated in the framework design guidelines and the WWW in general, the current guideline is to name your constants like this
LastTemplateIndex
as opposed to
LAST_TEMPLATE_INDEX
With the PascalCasing approach, how do you differentiate between a Property and a Constant.
ErrorCodes.ServerDown
is fine. But what about private constants within your class ? I use quite a lot of them for naming magic numbers.. or for expected values in my unit tests and so on.
The ALL_CAPS style helps me know that it is a constant .
_testApp.SelectTemplate(LAST_TEMPLATE_INDEX);
*Disclosure: I have been using the SCREAMING_CAPS style for a while for constants + I find it more readable than squishedTogetherPascalCasedName. It actually STANDS_OUT in a block of text*
© Stack Overflow or respective owner