Delphi Naming Standards : LUSENET : OCI Best Practices : One Thread

Naming Guidelines

Girls should be named "Brianne" or "Ashley". Boys should be named "Cody" or "Austin".

Tokens should be named descriptively using multiple words. Avoid abbreviations.


Constants are given descriptive, multi-word names, where words are delimited by underscores. All characters are uppercase. Examples:

const ORG_TYPE_LLC = '4';

Procedure names

Use mixed case to delimit the words in other procedure and function names. Examples:

function ObjectClassTypeForProducerID(anID: string): TOCIObjectClass;
procedure RemoveListeners; 
procedure InitializeForm;

Data types

Data type names use mixed case, and always begin with a "T". Examples

TCommonAncestorForm = class(TOCIForm)
TMethodReference = procedure of object;

OCIForm and OCIObject sub-classes

Business forms and objects are named to match the naming guidelines for units. Business objects (TOCIObject sub-classes) are named for the subsystem, business entity, appended with the word "object". Keep in mind that TOCIObject is a sub-class of TDataModule. TOCIForms are named after their associated business object, appended with the word "form". For example, a business object for an agent and its associated form could be named:


The units used to store the source code for a business object and its form are named "Unit" followed by the form or object name. Examples:


Units not associated with a sub-system

General purpose units and forms use "Common" in place of a sub-system name. Examples:


Component References

Component references (i.e., the component "Name" property) are named as the component's data type followed by words decribing the component. For example, an OK button might be named "ButtonOK". Delphi uses the data type as the default name, followed by a number. When placing a component on a form, simply highlight the "Name" property, and replace the numeric suffix with a description of the component. Examples:

LabelAddressHistory: TLabel;
ActionAddressNew: TAction;
ActionAddressDelete: TAction;
PanelLicenseAndAuthorization: TPanel;
GroupBoxLicenseInformation: TGroupBox;

Local Variables

Local variable names start with a lower case letter. Examples:

var i: integer;
var aComponent: TComponent;
var locked: boolean;

Interface and Implementation Variables

Interface and implementation variables follow the standards for procedures. Implementation variables used as class variables should start with the word "Private". Examples:

var PrivateReportList: TStrings;
var PrivateQueryReports: TQuery;

Private Instance Variables

Private instance variables start with "F". Examples:

FListOfPossiblePaidToDates: TList;
FPrimaryObject: TOCIObject;

Getter and setter routines

Getter and setter routines should begin with the words "Get" and "Set". Examples:

function GetChildCount: integer;
procedure SetOwnerForm(anOwnerForm: TOCIForm);

-- Anonymous, January 20, 2000


Fields that are directly associated with a database field should be named after the field. Examples:

anItem.FDomicile := Query.FieldByName('STATE').AsString; // Wrong!
anItem.FState := Query.FieldByName('STATE').AsString; // Right!

-- Anonymous, January 20, 2000

Moderation questions? read the FAQ