namingCodeConventions

Alvaro H Mamani-Aliaga

Naming Code Recommendations

In software development is a good recommendation to follow some naming conventions. The Java development community has several rules and in this project we get some of them.

Packages names

Packages name convention should be in all lowercase, e.g. br.unifesp.maritaca.core.Form

Classes and Interfaces

The first letter should be capitalized, and, if several words are linked to form the name, the first letter of the inner words should be uppercase, this is known as "camelCase".

  • In case of naming classes: the names should typically be nouns, e.g. Form, User.
  • In case of naming Interfaces: the names should typically be adjectives, e.g. Runnable, Serializable.

Methods

The first letter should be lowercase, and then normal camelCase rule should be used. In addition, the names should typically be verb-noun pairs: getForm, findUser

Variables

CamelCase format should be used, starting with lowercase letter. A variable should be short, meaningful names, e.g. buttonWidth, accountBalance.

Constants

Constants in Java are created by marking variables static and final. They should be named using uppercase letters with underscode characters as separators, e.g. MIN_LENGHT.


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.