I'm about to create a User class for my project. Any opinions as to whether it is bad practice to create such a commonly-named class? I could complement it with a prefix specific to my project.
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).
The standard Java naming convention demands that all reference types be written in PascalCase, also known as upper camel case.
By convention, Java programs are written entirely in lower case characters with three exceptions. The first letter of class names are capitalized to distinguish class names from member names. The names of constant fields are written entirely capital letters.
This is what packages are for.
I would suggest you to definitely prefix an application specific term to your User class. "User" is way too common and vague. You might easily end up using API which has "User" class or Interface. Though latest IDEs make it relatively easy to refactor your code, it would be cleaner and easier if you have a app specific "User" class.
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