Code Specification Common Specification

Source: Internet
Author: User

Code Specification Common Specification

A. Name:

1. The naming requirement is meaningful and readable, that is, by naming it, you can see the namespace, the class, the function, what this variable is used for.

2. Try to use English as well as pinyin

3. Try not to use abbreviations

4. Recommended ReSharper, with its naming grammar basically no problem.

5. The name must be unified, the same name in different classes, different projects are expressed the same meaning

6. Database fields and Entity fields are consistent

Two. Class

1. A class can contain only one entity (Class)

2. The field name is consistent with the database name and is generally used by the build tool

3. The method of the class, in addition to inheriting the overridden method, the other is used static method, call convenient

Three. Decoupling and

1. Try to ensure the atomicity of methods and classes

2. One method only implements one function

3. Classes and classes, methods and methods of interaction, as far as possible through the third party, such as the need to call method A after method B, not directly in the method of a call B, but Add method C, let C to call a and B. This way, the coupling between A and B is lifted.

Code Specification Common Specification

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.