1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

Delphi Identifier Naming Conventions
How to name all those variables and components you use in your daily Delphi programming.

The name of an identifier (variable, component, ...) plays a fundamental role in (Delphi) programming.

The Hungarian naming convention is quite useful — it's one technique among many that helps programmers produce better code faster. Since most of the API headers and documentation Microsoft has published over the last years have used Hungarian notation names for identifiers, many programmers have adopted one variation or another of this scheme for naming their identifiers.

In Delphi, using Hungarian notation, variable names begin with one or more lowercase letters that denote the variable type, thus providing an inherent identification. For example, the prefix h is used to identify a handle, as in hWnd or hDlg, referring to window and dialog box handles, respectively.

All components should be given descriptive names. No components should be left with their default names assigned by Delphi (Class name without the T letter plus a number). Components are to have a lowercase prefix to designate their type.

The following table defines some of suggested Delphi object name prefixes:

Category: in Types and classes

Object Prefix Example
Exception E EMyError = Class(Exception)
Classes and Types T TMyClass = Class(TObject)
Fields in classes f fVisible
Events On OnMouseDown

Category: Variables

Type Prefix Example
string s sSurName
Boolean b bIsThisOK
Integer i iBirthYear
Pointer p pMePointer
DateTime dt dtBirthday
Currency cur curSallary

Category: Components

Type Prefix Example
Form frm frmMain
Button btn btnOK
Label lbl lblName
Edit ed edPassword
ComboBox cbo cboFont
ListBox lb lbFiles
Table tbl tblMaster
Query qry qrySumChild
DataBAse db dbDataBase
PaintBox pb pbMyPicture
MediaPlayer mp mpMP3Player
OpenDialog OpenDialog OpenDialog

©2016 About.com. All rights reserved.