Sorting out the naming code and reconstructing ideas

Source: Internet
Author: User code does not appear in Chinese, most comments can appear in Chinese

2. Local variable naming, static member variable naming

Can only contain letters, the first letter of the word is uppercase, and all other letters are lowercase.

3. Constant naming

Can only contain letters and _, all uppercase letters, words separated by _

4. The picture as far as possible split into multiple reusable pictures

5. The server can realize, do not put on the client

6. The use of Third-party libraries should be prudent to avoid the application of large capacity of Third-party libraries, resulting in a very large client package

7. Handle applying global exceptions and errors, sending errors as messages to the server

8. Picture of. 9 Processing

9. Use the static variable mode to realize the sharing between the interface to be careful

10.Log (System name Module name Interface name, detailed description)

11. Unit Test (logic test, Interface test)

12. Do not reuse the handler of the parent class, and the handler of a class should not be used for its subclasses, or it will cause message.what conflicts

13.activity to handle all the logic in a View.onclicklistener

Using%1 $ s in 14.strings.xml to implement string wildcard

15. If multiple activity contains common UI processing, you can refine a commonactivity, call the generic part to be handled by it, and other activity simply inherits it

16. When using Button+activitgroup to implement the tab effect, use button.setselected (true) to ensure that the button is selected and that the current activity of activitygroup corresponds to that button

17. If you are developing a generic component, add a prefix to the filename in the Drawable/layout/menu/values directory to avoid conflicts

18. Data must be tested, such as character-type digital type, if the conversion failure must have a default value;

19. Service-side response data are valid judgments

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: 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.