Skip to content
Advertisement

Tag: naming-conventions

What is the convention for word separator in Java package names?

How should one separate words in package names? Which of the following are correct? com.stackoverflow.my_package (Snake Case using underscore) com.stackoverflow.my-package (Kebab Case using hyphens) com.stackoverflow.myPackage (Camel Case) com.stackoverflow.MyPackage (Pascal Case) What is the general standard? Answer Here’s what the official naming conventions document prescribes: Packages The prefix of a unique package name is always written in all-lowercase ASCII letters and

Naming convention for utility classes in Java

When writing utility classes in Java, what are some good guidelines to follow? Should packges be “util” or “utils”? Is it ClassUtil or ClassUtils? When is a class a “Helper” or a “Utility”? Utility or Utilities? Or do you use a mixture of them? The standard Java library uses both Utils and Utilities: javax.swing.Utilities javax.print.attribute.AttributeSetUtilities javax.swing.plaf.basic.BasicGraphicsUtils Apache uses a variety

Variable naming conventions in Java

In PHP, we (at least the good programmers) always start general variable names with a lower-case letter, but class variables/objects with an upper-case letter to distinguish them. In the same way we start general file names with a lower case letter, but files containing Classes with an upper case letter. E.g.: Are the conventions the same in Java, i.e., objects

Advertisement