Is it good to have java class name like ExtractionUtils.In naming conventions I no where found anything about plural name of the java class.
I have seen classes like this in one of the project.
Definitely singular. You don't create an object of People , you create a collection of Person objects. The only time I would use plurals would be for static classes, i.e. SupportServices , StringUtils , etc. However in this case, the class acts more as a namespace than anything else.
Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).
singular just like database table names should always be singular but for different reasons. Look at any popular standard library like Java or Python for example.
Java class names usually begin with a capital letter. Java class names cannot begin with a number. if there are multiple words in the class name like "MyClassName" each word should begin with a capital letter.
Arrays
, Collections
, Executors
, Files
, Objects
, Utilities
[!] - examples from JDK. It kind of violates OO design since all these classes are just namespaces holding utility or factory methods of objects in question while the name suggest they actually contain or maintain a collection of such objects. But being reasonable - I find these names readable and completely fine.
BTW looks like such a naming convention was very popular among Java 7 API designers.
Yes perfectly acceptable to have plurals, look at Collections
for example, it is a class which has many static methods which help when dealing with different flavours of collection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With