3. Code Presentation Conventions

In addition to the standard document conventions covered in Section 2 Document Conventions, there are some additional conventions related specifically to discussing source code:

classname

This is the name of a class in an object-oriented (OO) programming language. For example, the class com.arsdigita.categorization.CategoryTreeNode.

method name

This is the name of a method in an OO programming language, e.g. the method getBaseDataObjectType.

function

The name of a function or subroutine, as in a programming language. For example, the function SecurityLogger.warn().

variable name

The name of a variable. For example, the variable BASE_DATA_OBJECT_TYPE.

option

An option for a software command or Method. For example, a user has been granted read privileges on an object.

return value

The value returned by a function. For example, a method returns null.

replaceable

Content that may, must or will be replaced by the user or a program. For example, the code is commented with NOTE(n), where n is the number of the NOTE.

program listing

A literal listing of all or part of a program. The \ character is used to break a line for printing purposes. You will want to reconnect them back into a single line, preserving the spacing in the line.

import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.kernel.permissions.PermissionDescriptor;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.persistence.OID;

OID acsObject = new OID("example.MyACSObject",
new BigDecimal(50));

OID party = new OID("com.arsdigita.kernel.Group", new BigDecimal(5));


PermissionDescriptor perm =
new PermissionDescriptor(PrivilegeDescriptor.READ,
acsObject, party);

PermissionService.grantPermission(perm);
first term

The first occurrence of a term, such as the first time we introduce a bulletin-board and note its abbreviated form, bboard.