Thoughts on the Java naming specification

Source: Internet
Author: User

one, The content of the note () is their own spit groove

Ii. Naming Conventions

    1. cannot start and end with an underscore or dollar Symbol. counter example:_name, $name, name_,name$. (i've never used it this way.)
    2. You cannot use phonetic and English combinations to name Them. Not to be named after Pinyin (english rotten, sometimes made such mistakes)
    3. Class name adherence to hump rules (observed)
    4. Method name, parameter name, member variable name, local variable name uniform lowercamelcase format (observed)
    5. Constant capitalization, the words are separated by underscores, and to express a clear meaning, a long point can be (has been observed)
    6. abstract class naming using Abstract or base, the exception name ends with exception, and the test class name ends with the class name +test (not previously Written)
    7. the array definition takes string[] args format (always the Same)
    8. The Boolean variable of the Pojo class cannot be started because some frames cannot be parsed (observed)
    9. The package name is lowercase and only has a natural semantic English word (my understanding is only one word). The package name is in the singular form (has been complied With)
    10. Eliminate all non-canonical abbreviations (have been complied With)
    11. If a design pattern is used, a specific format is shown in the class name, such as Orderfactory,loginproxy. (has been complied With)
    12. the methods and properties of an interface class cannot be added with any modifiers, including Public. Keep your code neat. Add a valid Javadoc Comment. Try not to define variables in the Interface. Unless it is related to an interface method. (add Public before , correct later)
    13. Implementation classes for service and DAO classes are distinguished by impl suffixes and interfaces (observed)
    14. enumerating class names suggests taking the Enum SUFFIX.
    15. 15. "reference" to the naming conventions of each layer:
      A) Service/dao Layer Method naming protocol (sorry I often suffix)
      1) the method to get a single object is prefixed with Get.
      2) the method to get multiple objects is prefixed with the List.
      3) the method that gets the statistic value is prefixed with Count.
      4) Insert the method prefix with save (recommended) or Insert.
      5) Remove the method prefix with remove (recommended) or Delete.
      6) the modified method is prefixed with Update.
      B) domain Model naming conventions (not yet Used)
      1) data object: xxxdo, XXX is the data table Name.
      2) data transfer object: xxxdto, XXX for the business domain related Names.
      3) display object: xxxvo, xxx is generally the name of the Web Page.
      4) POJO is a general term for do/dto/bo/vo, and is forbidden to be named Xxxpojo.

Thoughts on the Java naming 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.