Delphi Code Standard - Document Name

zhaozj2021-02-16  45

File naming

1 Project file: The name of the project file should have a description.

For example: "The Delphi 5 Developer's Guide Bug Manager" project name is DDGBUGS.DPR A system information program named Sysinfo.dpr.

2 Form file: The name of the form file should express the use of the form, and with the FRM suffix.

For example: The file name of the Student Form is called StudentFrm.dfm, and the file name of the main form is called mainfrm.dfm.

3 Data Module File: The name of the data module file should express the role of the data module and have a DM suffix.

For example, the file name of the Student data module is called StudentDM.dfm.

4 Remote Data Module File: The name of the remote data module file should express the use of the remote data module. The name is RDM suffix.

For example: the file of the remote data module is STUDENTRDM.DFM.

5 unit file

Structure of ordinary units

(1) Unit Name: The name of the unit should be descriptive.

For example: The main window of the application is called mainfrm.pas.

(2) Uses sentence: The USES clause of the Interface section should only contain the unit required by this section. Do not include a unit name that may be automatically added by Delphi. The USES clause of the Implementation section should only contain the unit required by the part, and do not have extra units.

(3) Interface section: The Interface section should only contain the type, variable, process and function of the external unit access. Moreover, these statements should be in front of the Implementation section.

(4) Implementation section: I m p L E M e n t a t i O n Part includes the type, variable, process and function of this unit.

(5) INITIALIZATION section: Do not put a lot of time spent in part of I N i t i a l i z a t i O n. Otherwise, it will cause a very slow when the application starts.

(6) Finalization section: Make sure all resources allocated in the I n i t i a l i z a t i O n section are released.

6 Form Unit: The name of the form unit file is the same as the corresponding form name.

For example, the cell name of the StudentFrm form is called StudentFrm.PAS.

7 Data Module Unit: The name of the data module unit file is the same as the corresponding data module name.

For example: The name of the data module unit is called StudentDM.PAS.

8 Universal Unit: The name of the general unit should express its use.

For example, the name of a control unit is called Control.PAS, and the unit name containing global variables is StudentGlobals.PAS. (Note that the unit name in a project must be unique. The general unit name cannot be renamed.)

9 Component Unit: The component unit should be placed in a separate path to indicate that they are the unit defining components. They are generally not placed under the same path as the project. The unit file name should express its content.

10 File Head: All source files and project files should have a file header.

A correct file header should contain the following information:

{

Copyright @ Year by Authors

}

转载请注明原文地址:https://www.9cbs.com/read-26363.html

New Post(0)