If my class name contains any acronyms then how can i name?
Ex: SomeDAO or SomeDao
Also, if any variable has acronyms, how can i name?
Ex: private String appUID
or private String appUid
Thanks!
If my class name contains any acronyms then how can i name?
Ex: SomeDAO or SomeDao
Also, if any variable has acronyms, how can i name?
Ex: private String appUID
or private String appUid
Thanks!
From code convention for java provided by oracle :
Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML
As DAO is widely used and accepted , i would go for SomeDAO
Quote from wiki:
Treatment of acronyms in identifiers (e.g. the "XML" and "HTTP" in XMLHttpRequest) varies. Some dictate that they be lowercased (e.g. XmlHttpRequest) to ease typing and readability, whereas others leave them uppercased (e.g. XMLHTTPRequest) for accuracy. A less popular option is to always expand any acronyms (e.g. ExtensibleMarkupLanguageHyperTextTransferProtocolRequest).
There is no ideal convention though but ideal approach should be to stick with whatever convention is choosen.
On a side not, following corner case could be considered: com.x.y.XMLHttpReq com.x.y.XMLHTTPReq
Assume that both of above were in different source folder and on-compilation bundled under one jar
or bin
folder:
Windows (case in-sensitive) - may override or compiler error (depends if bulk compiled)
*NIX (case sensitive) - fine