1. Introduction to the specifications
This specification mainly stipulates the rules and precautions that Delphi source programs should follow during the writing process. The purpose of writing this specification is to keep the source code writing habits of company software developers consistent. Doing so that each group member can understand the code of other group members, so as to facilitate the secondary development of source code memory system maintenance.
2. Unit format
2.1 Basic Requirements
2.1.1 Indentation
Indentation is the two spaces exposed to increase readability when the level of the source program changes. The rule of indentation is to indent two spaces for each level. Tab is not allowed. Because Tab will produce different effects due to different settings made by the user. When you encounter begin or enter judgment, loop, exception handling, with statement, record type declaration, class declaration, etc., add one level. When you encounter end or exit judgment, loop, exception handling, with statement, record type declaration, Class declarations, etc. will be reduced by one level.
2.1.2 Begin…End
The begin statement and the end statement should occupy a single line in the source program, for example:
for I := 0 to 10 do begin //Incorrect usage
end;
for I := 0 to 10 do //Correct usage
Begin
end;
2.1.3 Spaces
Add spaces at both ends of operators and logical judgment symbols, such as: I := I + 1;, a and b, etc.
But no space is needed when adding brackets.
For example: if ( a>b ) and( a
if (a > b) and (a < c) then //Correct usage
2.1.4 Variables
Try not to use abbreviations, try to use nouns. If there are multiple words, the first character of each word must be capitalized; see the name and meaning
All global variables in modules must be prefixed with 'F'. If data exchange is required between several modules, it needs to be implemented by declaring attributes.
2.2 Unit Description
When creating a new unit file, please first customize the unit description in the following format.
{********************************************************* *******
Copyright?(c)?2000-2004?********* Company Technical Development Department
PRoject:---The project to which this unit belongs
Module:---The functional module to which this unit belongs
Describe:---The function of this unit
Author:---Create
Date:---Creation date
Version version number:
History`s Modification:---Modify historical area
{******************************
Modify No:---Modify number
Modifier:---Modify
DateTime:---Modify time
Cause:---Reason for modification
Modify No:---Modify number
Modifier:---Modify
DateTime:---Modify time
Cause:---Reason for modification
******************************************
********************************************************* *****}
2.3 Description of processes and functions
{********************************************************* *******
PrcedureeName/FunctionName:
Input: a---Input parameter description, b---Input parameter description, c---Input parameter description
Output: x---Output parameter description
Const: s---Constant description, t---Constant description
var: x---Variable Description, j---Variable Description
Describe:----Function Description
If the process or function is not written by the creator of the unit, please add the following items later:
Author:
Date:
********************************************************* *****}
3. Naming of controls
The name of the control can be used with the following abbreviation, but the abbreviation used is added between the control name '_':
Standard Tab
mm TMainMenu
pm TPopupMenu
mmi TMainMenuItem
pmi TPopupMenuItem
lbl TLabel
edt TEdit ; TSpinEdit ; TMaskEdit
mem TMemo
btn TButton ; TBitBtn ; TSpeedButton ; TSpinButton
cb TCheckBox
rb TRadioButton
lb TListBox
cb TComboBox
scb TScrollBar
gb TGroupBox
rg TRadioGroup
pnl TPanel
cl TCommandList
Additional Tab
sg TStringGrid
dg TDrawGrid
img TImage
shp TShape
bvl TBevel
sbx TScrollBox
clb TCheckListbox
spl TSplitter
stx TStaticText
cht TChart
Win32 Tab
tbc TTabControl
pgc TPageControl
il TImageList
re TRichEdit
tbr TTrackBar
prb TProgressBar
ud TUpDown
hk THotKey
ani TAnimate
dtp TDateTimePicker
tv TTreeView
lv TListView
hdr THeaderControl
stb TStatusBar
tlb TToolBar
clb TCoolBar
System Tab
tm ??TTimer
pb ??TPaintBox
mp ?TMediaPlayer
olec ?TOleContainer
ddcc ?TDDEClientConv
ddci ?TDDEClientItem
ddsc ?TDDEServerConv
ddsi ?TDDEServerItem
?
Samples Tab
gg?? TGauge
cg?? TColorGrid
spb?
spe?
dol? TDirectoryOutline
cal? TCalendar
ibea? TIBEventAlerter
?
ActiveX Tab
cfx? TChartFX
vsp?? TVSSpell
f1b?? TF1Book
vtc?? TVTChart
grp?? TGraph
?
Win31 Tab
dbll?? TDBLookupList
dblc?? TDBLookupCombo
ts???? TTabSet
ol???? TOutline
tnb??? TTabbedNoteBook
nb???? TNoteBook
hdr??? THeader
flb??? TFileListBox
dlb??? TDirectoryListBox
dcb?? TDriveComboBox
fcb?? TFilterComboBox
Midas Tab
prv?? TProvider
cds?? TClientDataSet
qcds?? TQueryClientDataSet
dcom? TDCOMConnection
olee?? TOleEnterpriseConnection
sck?? TSocketConnection
rms?? TRemoteServer
mid?? TmidasConnection
Internet Tab
csk?TClientSocket
ssk?TServerSocket
wbd ?TWebDispatcher
pp ???TPageProducer
tp ???TQueryTableProducer
dstp? ?TDataSetTableProducer
nmdt ??TNMDayTime
nec ???TNMEcho
nf ????TNMFinger
nftp ???TNMFtp
nhttp ??TNMHttp
nMsg ??TNMMsg
nmsg ??TNMMSGServ
nntp ???TNMNNTP
npop ???TNMPop3
nuup ???TNMUUProcessor
smtp ???TNMSMTP
nst ????TNMStrm
ns ???TNMStrmServ
ntm ???TNMTime
nudp ??TNMUdp
psk ???TPowerSock
ngs ???TNM GeneralServer
html? ?THtml
url? ??TNMUrl
sml ??TSimpleMail
Data access Tab
ds? ?TDataSource
tbl? ?TTable
qry? ?TQuery
sp ??TStoredProc
db ??TDataBase
ssn? ?Tsession
bm ??TBatchMove
usql ??TUpdateSQL
Data Controls Tab
dbg? ?TDBGrid
dbn ??TDBNavigator
dbt ??TDBText
dbe ??TDBEdit
dbm? ?TDBMemo
dbi ??TDBImage
dblb ??TDBListBox
dbcb? ?TDBComboBox
dbch? ?TDBCheckBox
dbrg ??TDBRadioGroup
dbll ??TDBLookupListBox
dblc ??TDBLookupComboBox
dbre ??TDBRichEdit
dbcg ??TDBCtrlGrid
dbch ??TDBChart
Decision Cube Tab
dcb ??TDecisionCube
dcq ??TDecisionQuery
dcs ??TDecisionSource
dcp ??TDecisionPivot
dcg ??TDecisionGrid
dcgr ?TDecisionGraph
QReport Tab
qr ??TQuickReport
qrsd ?TQRSubDetail
qrb ??TQRBand
qrcb ??TQRChildBand
qrg ??TQRGroup
qrl ??TQRLabel
qrt ??TQRText
qre ??TQREexpr
qrs? ?TQRSysData
qrm ??TQRMemo
qrrrt ??TQRRichText
qrdr? ?TQRDBRichText
qrsh ??TQRShape
qri ???TQRImage
qrdi ??TQRDBMImage
qrcr? ?TQRCompositeReport
qrp ??TQRPreview
qrch TQRChart
Dialogs Tab
OpenDialog ????????TOpenDialog
SaveDialog ???????TSaveDialog
OpenPictureDialog?TOpenPictureDialog
SavePictureDialog ??TSavePictureDialog
FontDialog ?????????TFontDialog
ColorDialog ???????TColorDialog
PrintDialog ????????TPrintDialog
PrinterSetupDialog? ?TPrintSetupDialog
FindDialog ??????????TFindDialog
ReplaceDialog ??????TReplaceDialog
4. Request for modification
4.1 Modify the history record
When making approved modifications to the source file, the modifyer should add a modification history item to the program file header. In each subsequent modification, the modifyer must fill in the following information in the item:
Modifier:
DateTime:
Cause:
Comment:
4.2 Add new code line
The new code line should have commented lines before and after.
// ab Modify person; Modify time; Modify instructions.
Added line of code
// ae
4.3 Delete the code line
Use comment lines to describe before and after deleting the code line.
//db Modify person, modification time, modification instructions.
//The line of code to be deleted (comment the statement to be deleted)
//de
4.4 Modify the code line
Modify the code line to delete the code line and add new code lines.
//mb Modify person, modification time, modification instructions.
//pre code line before modification
Modified line of code
//me
5. File naming
The project file must use a meaningful name. For example: The project file for system information in Delphi is named SysInfo.dpr.
3.7.2 Form file
Consistent with the name of Form: For example: if the name of Form is frrmMain, then the name of the Form file is frmMain.dfm. The corresponding Unit file is frmMain.pas
3.7.3 Data Module File
The naming of the data module file should make sense and use 'DM' as the prefix. For example: The user data module is named 'dmCustomers.dfm'. The corresponding Unit file is rdmCustomers.pas
3.7.4 Remote Data Module File
The remote data module file name should make sense and use 'RDM' as the prefix. For example: the user remote data module is named 'rdmCustomers.dfm'. The corresponding Unit file is rdmCustomers.pas
3.7.5 Normal Unit Files
The naming of the unit file should make sense and use 'u' as the prefix. For example: The generic unit is named 'uGeneral.pas'.