Skip to content
Yevhenii Voevodin edited this page Oct 27, 2015 · 1 revision

Generally

  • A-Z, a-z, 0-9 and underscore _ may be used for name definition
  • Name always starts from a letter
  • Underscore appears only in constants

Package names

Package name is written in lowercase

import com.codenvy.api.workspace;

When 2 or more words appear it should be concatenated together

// Not allowed, underscore is not used for package names
import com.codenvy.api.new_workspace;
// Good
import com.codenvy.api.newworkspace;

Class names

Class name is written in UpperCamelCase, underscore must be avoided

class WorkspaceService {
interface Mapper {

Method names

Method name is written in lowerCamelCase

void doNothing()
String join()

Constant names

Constant name is written in CONSTANT_CASE (all letters are uppercase)

static final Logger LOG = LoggerFactory.getLogger(MyClass.class);
static final int DEFAULT_COUNT = 30;
static final Set<String> ROLES = unmodifiableSet("system/admin")

Non-constant field names

Non-constant field name is written in lowerCamelCase

static final List<String> mutableList = new ArrayList<>();
static final String[] roles = new String[] {"system/admin"};

final String name;
final String email;

Parameter names

Parameter name is written in lowerCamelCase

public void doNothing(String argument1, String secondArgument) {

Local variable names

Local variable name is written in lowerCamelCase

final Workspace workspace = getWorkspace();
String memberRole = null;

Clone this wiki locally