Four common naming methods
Comparing the different points of the naming conventions of Java and C #
Uppercase for constants
Java method The first letter is not written, it should be lowercase
function line number limit
Do not use Pinyin
Referential, Android source code
See source Tools, Sourceinsight and Beyond Compare
The same kind of import in the same place
Android documents implemented via Java.doc
The private program variable is named before the top plus m
Catalog specification
System catalog specification, project-level documentation
- Deployment
- Requirement (Requirements-related documentation)
- Designn
- Planning
- Help
- Log
- Source
- Publish
- Test
Source code Naming conventions
- Catalog-Ready (Package)
- All classes in the directory belong to this namespace: One main class one file
- Directory hierarchy recursion
- General System namespace directories try not to exceed 3 levels
Code naming conventions naming methods
Hungarian nomenclature: Strmyname,mmyname,int intmyname use a prefix to mark something, commonly used in VB6
Pascal nomenclature: Capitalize the first letter of each word MyName
Camel nomenclature: Hump naming method first letter lowercase, other initial uppercase Java variable name myName
Underline naming method: S_myname,m_name
Private member Variable Pascal name + prefix m
Static member variable Pascal name + prefix s, in the method does not add s
Local variable camel nomenclature, or the use of underscores to start with the Pascal method
Method parameters camel Nomenclature, prefixed with P
Variables in the loop can use meaningless letters
Note: Files, classes, methods, method parameters, variables, attributes are all commented
Comments for files and classes must include the following elements: Name,descrition,version,date,author,change,copyright
Follow the Javadoc standard
Coding Logic Specification
Avoid placing multiple classes in a single file, except for one-time use of internal classes
The code length of one method should not be more than 35 lines
In principle, try not to manually modify the machine-generated code
Final string supersedes direct string, same as int
It is not recommended to have a direct return operation in a looping statement
Do not use Goto
Consider exceptions everywhere
Public is only required for external use, the rest is private or internal
Try not to provide public and protected programmer variables, use attributes instead of them
Do not write business code directly on a function that is automatically generated by the system, preferably a custom function, and then call
Always use interface, it is recommended to use display interface to implement
Always have default words in the switch statement to display the information
Android Encoding Specification