Android code specification 03, android code 03

Source: Internet
Author: User

Android code specification 03, android code 03

I. sundy suggested the following directories for the entire project: system directory specification and source code directory specification.

1. System Directory specifications:

The project directory contains not only the source code, but also the requirement-related documents, design documents, plan log documents, test documents, and project learning documents (refer to the Demo ); make the entire project clearer,

2. Source Code directory specification:

Generally, the system namespace Directory should not exceed three layers. [organization name]. [project name]. [Module name]: mobidever. camera. pubshpic

Ii. common naming rules

1. Pascal naming method: String MyName; int MyAge // class name in JAVA

2. Camel naming method: String myName; int myAge // common in Java, Method Name

3. Hungarian name method: String strMyName; (VB6) String sMyName; int intMyName; // table name type prefix, attribute name

4. Underline naming: String s_MyName; private String m_MyName;

 

Private property: private int mAge;

Static variable: static String sName;

Internal variable of the function: int _ Age;

Parameter for method definition: int pAge;

It is better to form a good style and clearly distinguish the variables.

3. Notes

File, class, method, method parameter, variable, and attribute.

1. File and class annotations are in the JavaDoc format.

/**

*/

2. Variable comment: // my name

Private String mName;

Iv. import

Put them together, that is, all the namespaces defined by the framework are a group, and the custom and third-party namespaces are placed in another group.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.