-
For 4+ letter acronyms, use lowercase. E.g.
LdapUtils
,HttpURL
. -
For 2 and 3 letter acronyms, use uppercase. E.g.
IOUtils
,XMLUtils
.
-
Do NOT prefix interfaces with
I
. Interface names should represent their role in the system without any syntactic markers. E.g.UserService
, notIUserService
. -
Do NOT postfix implementations with
Impl
. Instead, focus on meaningful and descriptive names. E.g.LdapUserService
, notUserServiceImpl
. -
Descriptive naming for multiple implementations: If there are multiple implementations of an interface, make sure each class name reflects its purpose or underlying mechanism, e.g.
LdapUserService
,JdbcUserService
. -
If only one implementation exists and the interface is required only for technical purposes (e.g., remoting), prefix the implementation with
Default
, and use the same name for the interface and the class. E.g.DefaultUserService
.
- Use UPPERCASE letters and separate words with underscores, e.g.
MAX_LENGTH
,DEFAULT_TIMEOUT
.
-
Format your code contributions using the vegardit.com Eclipse formatter rules.
IntelliJ users can use the Eclipse Code Formatter plugin to import and use the formatter settings.
To format the source code on the command line use
mvn process-sources -Dformatter.skip=false
-
Consistent line length: Maintain a maximum line length of 140 characters.
-
Use spaces, not tabs: Set the indentation to 3 spaces per level.
-
Braces placement: Use the K&R style (braces on the same line), e.g.:
if (condition) { // action } else { // action }