File naming 1 Project file: The name of the project file should be descriptive. For example: The project name of "The Delphi 5 Developer's Guide Bug Manager" is DDGBugs.dPR and the name of a system information program is SysInfo.dpr. 2 Form file: The name of the form file should express the purpose of the form and have the suffix Frm. For example: the file name of the Student form is StudentFrm.dfm, and the file name of the main form is 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 StudentDM.dfm. 4 Remote data module file: The name of the remote data module file should express the purpose of the remote data module. The name must be followed by the RDM suffix. For example: the file of the remote data module is called StudentRDM.dfm. 5 Unit file 1. Structure of ordinary unit (1) Unit name: The name of the unit should be descriptive. For example: the main form unit of the application is called MainFrm.pas. (2) Uses sentence: The Uses clause of the Interface part should only contain the units required by this part. Do not include unit names that may be added automatically by Delphi. The Uses clause of the Implementation part should only contain the units needed for this part, and no extra units. (3) Interface part: The Interface part should only contain declarations of types, variables, procedures and functions that need to be accessed by external units. Furthermore, these declarations should precede the Implementation section. (4) Implementation part: The Implementation part includes the implementation of the private types, variables, procedures and functions of this unit. (5) Initialization part: Do not place code that takes a lot of time in the Initialization part. Otherwise, it will cause the application to start very slowly. (6) Finalization section: Ensure that all resources allocated in the Initialization section are released. 6 Form unit: The name of the form unit file is the same as the corresponding form name. For example: the unit name of the StudentFrm form is 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 StudentDM.pas. 8 General Units: The name of a general unit should express its purpose. For example: the name of a control unit is Control.pas, and the name of the unit containing global variables is StudentGlobals.pas. (Note that unit names must be unique within a project. Common unit names cannot have the same name.) 9 Component units: Component units should be placed in separate paths to indicate that they are the units that define the component. They are generally not placed in the same path as the project. Unit file names should express their contents. 10 File header: All source and project files should have a file header. A correct file header should contain the following information: {Copyright @ YEAR by AUTHORS}