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.