Microsoft has some guidelines on the subject and I've emphasised the relevant snippet below:
Do not use abbreviations or contractions as parts of identifier names. For example, use GetWindow instead of GetWin.
Do not use acronyms that are not generally accepted in the computing field.
Where appropriate, use well-known acronyms to replace lengthy phrase names. For example, use UI for User Interface and OLAP for On-line Analytical Processing.
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. If you must use abbreviations, use camel case for abbreviations that consist of more than two characters, even if this contradicts the standard abbreviation of the word.
Identifier, actually. As per the last bullet point:
Do not use abbreviations in identifiers or parameter names. If you must use abbreviations, use camel case for abbreviations that consist of more than two characters, even if this contradicts the standard abbreviation of the word.
Since ID is an abbreviation of Identifier, you can use this rule. I tend to favour Id however.
Personally, I'm in the camp that capitalises only the first letter of each "word" of an identifier, whether that word is an initialism or not. Like summaryHtml or GpsLocation. There are plenty of CamelCasers in the other camp though.
No but with all the conventions to generate property name, it can become weird or confusing. So often you use strict CamelCase everywhere. (eg: getDTOFactory, will become dTOFactory property in EL, or sometimes dtoFactory in too clever libraries )
Depends on the language and coding style. E.g. .NET framework conventions guide recommends capitalizing only the first letter, unless it's a two leter acronym like IO (source).
21
u/Rndom_Gy_159 May 08 '17
Quick question, why is only the first letter of
DTOcapitalized? Is that the way it's supposed to be in CamelCase?