1. Naming of variables
The name of the variable should be able to express its purpose, such as Sname, SbirthDay, etc.
Customary loop control variables are often single letters, such as I, J, K, etc. If you use a more meaningful name, such as iCount, it will make the loop easier to understand.
Boolean variable names must clearly indicate the meaning of True and False values, such as IsRight.
2. Component naming
The naming of a component must be able to express the purpose and type of the component. Generally, the prefix is added, the first half represents the type and the second half represents the purpose. For example, the form class From is generally added with frm, the button class is added with btn, and the text box class is added with edt.
3. Naming of data module form
In addition to expressing the purpose of the data module, the suffix DM is generally added. For example, the data module form in employee management can be named EmployeesDM.
4. Unit file naming
Unit files should generally be the same as the form file name. If it is a public unit file, in addition to expressing the function of the unit file, it also needs to add the prefix u.
5. Naming of procedures and functions
Procedures and function names should make sense, that is, the purpose of a procedure or function can be understood from the name.
It is best to prefix the name of a verb that represents the action. For example, delete Doc format file: PRocedure DeleteDocFile;.
The process name for setting the input parameter value should be prefixed by Set. For example, the process for setting UserName is: procedure SetUserName;.
The function name that obtains a numeric value should be prefixed with Get. For example, the function that obtains UserName is: function GetUserName:string;.
6. Naming of formal parameters
The names of all formal parameters should express their purpose. If appropriate, the name of the formal parameter is preferably prefixed with the letter a. For example: procedure DBLogin(aUserName, aPassWord:string);.
7. Class naming
In addition to being able to express the purpose of the class, a class name should generally be added before the class name, an I should be added before the interface class name, and an E should be added before the exception class name. For example:
type
TCustomFlash=class(TObject);//Custom Flash class
IFlash = interface;//Flash interface
EFlash = class(Exception);//Flash exception class
8. Field naming
The naming habit of a field is the same as the naming of a variable, except that F is generally added before the field name.
9. Method naming
The naming of a method is the same as that of a procedure or function.