Java Package Naming conventions

Source: Internet
Author: User

Reproduced

Original address: http://blog.csdn.net/kongjiea/article/details/45365753

Java package names are composed of lowercase words, the class name is capitalized, and the path of the package conforms to the definition of the developed system module, such as production to production, material to material, base class to basic class. In order to see the package name to understand which module, so directly to the corresponding package to find the corresponding implementation.

Due to the Java object-oriented nature, each Java developer can write its own Java package, in order to guarantee the uniqueness of each Java packages naming, in the latest Java programming specification, developers are required to add a unique prefix to their own definition. Because domain names on the Internet are not duplicated, most developers use their company's domain name on the Internet as the only prefix for their packages. For example: COM.SUN.SWT .....

Thus, we know that the general company is named "com. Company name." Project name. Module name ....
So, how do we name our individual projects?

After my "personal" word search, there are "individual, personal, private, one-man", further to the above 4 words meaning analysis, and in the guarantee of uniqueness, using the first 4 letters of each word as a prefix, exactly and " Com "also made a distinction. As follows:

Indi :

An individual project, a project that is initiated by an individual but not done on its own, may be public or private, and the copyright is primarily the originator.

The package is named "Indi. Initiator name." Project name. Module name ... ".

Pers :

Individual projects, which are individual initiation, completion alone, shareable items, are mainly personal.

The package is named "Pers. Personal name." Project name. Module name ... ".

priv :

A private project, which is an individual-initiated, self-fulfilling, privately-used project, which belongs to the individual.

The package is named "priv. Personal name." Project name. Module name ... ".

onem :

As with "Indi", it is recommended to use "Indi".

In addition, in order to differentiate between the team project and the previously mentioned project, I also have a bit of an extension:

Team :

A team project, a project initiated by a team and developed by the team, is owned by the team.

The package is named"team." The name of the project name. Module name ....

com :

Company projects, copyright by the project initiated by the company owned.

The package is named "com. Company name." Project name. Module name ... ".

Java Package Naming conventions

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.