A short acronym is like ID or DB which has only 2 characters.
How to name these when pascal casing (for Property or Class names) and for Camel Casing (input prameters, arguments)?
I know each Company has their own standard but I'm looking for a more generally acceptable standard.
e.g. when pascal casing:
ProductID or ProductId?
IDOfProduct or IdOfProduct?
DBRate or DbRate?
RateOfDB or RateOfDb?
and when camel casing:
productID or productId?
idOfProduct?
dbRate?
rateOfDb or rateOfDB?
When using acronyms, use Pascal case or camel case for acronyms more than two characters long. For example, use HtmlButton or htmlButton . However, you should capitalize acronyms that consist of only two characters, such as System.IO instead of System.Io . Do not use abbreviations in identifiers or parameter names.
For example in Java, classes, interfaces and enums should all be written in Pascal case. Local variables declared within the body of a Java program should be written in lower camel case.
With PascalCase, the first letter of every word in the identifier is upper case. With camelCase, the first letter of the first word in the identifier is lower case, while the first letter of every subsequent word is uppercase.
Pascal case naming conventionWhen more than one word is needed to properly convey a variable's purpose, the PascalCase naming convention dictates that words be appended to each other. The use of a single uppercase letter for each additional word makes it easier to read code and discern the purpose of variables.
According to MSDN (or Msdn :)
Do capitalize both characters of two-character acronyms, except the first word of a camel-cased identifier.
Do capitalize only the first character of acronyms with three or more characters, except the first word of a camel-cased identifier.
Do not capitalize any of the characters of any acronyms, whatever their length, at the beginning of a camel-cased identifier.
More info here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With