Google Java Style Reading essays

Source: Internet
Author: User

Official document: Google Java Style

Chinese translation: Google Java Programming style guide, Hawstein ' s Blog

Can read the official documents first, encountered uncertainty in doubt, can be compared to the translation version of reading, deepen understanding.

5.2.1 Package Name

The package name is all lowercase letters, which simply connect consecutive words in the previous (without underlining).

For example: Use com.example.deepspaceinstead of com.example.deepSpace or com.example.deep_space.

5.3 Camel-style naming method

Name starting with a phrase:

    • Converts a phrase to a pure ASCII code and removes any single quotation marks. For example: "Müller ' s Algorithm" will become "Muellers algorithm".
    • Divide the result into words, separated by spaces or other punctuation (often hyphens).
    • Recommendation: If a word already has a common hump representation, split it up by its composition (such as "AdWords" will split into "ad words"). It is important to note that "IOS" is not a real hump representation, it violates the Convention, so this recommendation does not apply to it.
    • lowercase all letters (including abbreviations) and capitalize the first letter of a word:
    • Capitalize the first letter of each word to get a big hump-named (uppercamelcase)
    • In addition to the first word, the first letter of each word is capitalized to get the small hump-type name (Lowercamelcase)
    • Finally, link all the words together to get a representation.

Example

Prose Form Correct Incorrect
"XML HTTP Request" XmlHttpRequest XMLHTTPRequest
"New Customer ID" newCustomerId newCustomerID
"Inner Stopwatch" innerStopwatch innerStopWatch
"Supports IPV6 on IOS?" supportsIpv6OnIos supportsIPv6OnIOS
"YouTube Importer" YouTubeImporter
YoutubeImporter*

* Indicates yes, but not recommended.

Google Java Style Reading essays

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.