Android Naming Conventions
The android naming convention is same as java naming convertion.
This Naming conventions are very important thing to follow while develop best android applications.
Four things we need to concentrate while naming in android
1) Wheather it is a noun or verb.
2) Proper use of Characters.
3) No empty spaces are allowed.
4) Avoid using dollar($) symbol.
Package * Package name should be noun
* Package name should be lowercase letters
* Package name must be seperated with periods(.dot)
Example: com.android.shopping
com.bank.account
Class * Class name should be noun
* Class name should Initcap.
Example: AccountHolder, AccountType
Interface * interface name should be noun.
* interface name should Initcap.
Example: DataHelper, AccountName
Method * method name should be verb.
* starts with lowercase continue with InitCap
Example: processAccount(), getUserDetail(), diaplayUserDetails()
Variable *Variable name should be Meaningful and verb.
* starts with lowercase continue with InitCap
* for local variables like for , while can use lowercase(i,j,k).
* Allow dollar($),underscore(_)symbols.underscore is always recommended.
Example: buttonSubmit, edit_Text_UserName, _strTotal
Constant * Constants always in uppercase
* Underscore(_) is permittable
Example: HEAD_COUNT, MAXIMUM_SIZE
Control Structure
Even for single line statement we need to surround by block {}.This is for best practice.
Example:
Poor usage
if(true)
Statement;
Good usage
if(true)
{
Statement;
}
Comments
Put comments before doing anything in program. It make us better understanding when see it again.
nice posts.!
ReplyDeleteI would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. Thanks... clothing line names
ReplyDeleteYour blog is too much amazing. I have found with ease what I was looking. Moreover, the content quality is awesome. Thanks for the nudge! unique business names
ReplyDeleteThe article looks magnificent, but it would be beneficial if you can share more about the suchlike subjects in the future. Keep posting. short business names
ReplyDelete