Naming convention guidelines for Corelink

General Description

Globally

  • All functions should be camelcase
  • All variable names should be camel case

    The exceptions to the camel case rule are username and streamid.

  • The variable ID is not allowed, because it is used internally by the system if an ID for an object is required to use the object name and ‘id’ Example: userID
  • Abbreviations are capital (e.g. IP, MTU, ID)

Functions:
Common function uses and names:

  • Add an object should have ‘add’ prepend. Example: addUser
  • Remove an object should have ‘rm’ prepend. Example: rmUser
  • List objects should have ‘list’ prepend. Example: listUsers

Ordering of function names:

  • Functions should start with what they do and then add the object of interest
    Example: addUser, rmWorkspace, listUsers

Singular or plural:

  • Functions should be named to reflect if they operate on a single or many objects of interest
    Example: addUser, listUsers, rmUser

Variable Names

Input Values:

  • Object names should not be named with ‘name’
    Example: workspace, group

    The exceptions are the variables username, functionName.

Result values:

  • Result values should be ordered object of interest first and then type. The object of interest should be singular.
    Example: userList, workspaceList

  • Object names should just use the object word without ‘name’ attached. For example, usernames or workspace names are returned, we shorten to: userList, workspaceList

  • If the function returns an array of user names we shorten to object name. For example we return a list of usernames and app names: [ user, app ]

  • If we have an array inside an array we will use the object in plural. For example we want to return [user, [app]], we name the return: [user, apps]

Q and A:

  1. Should it be called a workspace or room?
    It should be called a workspace.

  2. Should the first letter if functions be capital (addUser vs AddUser)?
    No, it should be addUser.

  3. Should results of arrays be plural (usersList vs. userList)?
    No it should be userList.

  4. Should function names be plural (listUsers vs. listUser)?
    Yes, it should be listUsers

  5. Result variables should include ‘name’ (e.g. usernameList vs userList)?
    No, here we are removing the name and it will be userList. There is one exception and that is username.

  6. Shall we make an exception for username (instead of calling it user)?
    Yes, we will make the exception for username.

  7. Should variable names be camel case (userList vs. userlist)?
    Yes, it should be userList.

,