Naming conventions of composed package names

We Are Going To Discuss About Naming conventions of composed package names. So lets Start this Java Article.

Naming conventions of composed package names

  1. Naming conventions of composed package names

    From the documentation on package naming convention:
    Package names are written in all lower case to avoid conflict with the names of classes or interfaces

  2. Naming conventions of composed package names

    From the documentation on package naming convention:
    Package names are written in all lower case to avoid conflict with the names of classes or interfaces

Solution 1

From the documentation on package naming convention:

Package names are written in all lower case to avoid conflict with the names of classes or interfaces

So this would leave you with the following two possibilities:

form_validator
formvalidator

Actually the documentation also makes it clear that underscore plays a special role when it appears in package names:

if the package name begins with a digit or other character that is illegal to use as the beginning of a Java name, or if the package name contains a reserved Java keyword, such as “int” … the suggested convention is to add an underscore.

So, underscore is suggested only in special cases, into which your naming problem does not seem to fall. So I would recommend formvalidator as the package name.

Original Author Tim Biegeleisen Of This Content

Solution 2

The most conventional one would be the 3rd one: formvalidator.

The Google Java Style guide notes:

5.2.1 Package names

Package names are all lowercase, with consecutive words simply concatenated together (no underscores). For example, com.example.deepspace, not com.example.deepSpace or com.example.deep_space.

As @teppic said, the Oracle Java Docs state that

Package names are written in all lower case to avoid conflict with the names of classes or interfaces.

Original Author srath Of This Content

Solution 3

In Java package names are written in all lower case. Which means following would be the most ideal packaging name.

formvalidator

This is also accepted.

form_validator 

Original Author Dulith De Costa Of This Content

Solution 4

Package names are written in all lower case to avoid conflict with the names of classes or interfaces. So

  • form_validator or
  • formvalidator.

For details see here.

Original Author Rafiqul Hasan Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment