ZT: Delphi Source Process Format Writing Specification

zhaozj2021-02-12  141

Delphi Source Process Format Writing Specification 1. Specification Introduction This specification is mainly specified in the rules and precautions that the Delphi source program should follow. The purpose of writing this specification is to keep the source code of the company software developers. Doing so allows each group of members to understand the code of other group members so that the maintenance of the secondary development memory system of the source code. 2. General Format Specification 2.1 Indenting Indentation is two spaces exposed by increasing readability when changing the level of the source program. The indented rules are indented to two spaces per level. Not allowed to use Tab. Because Tab will produce different results due to the settings made by the user. When you encounter Begin or enter judgment, cycle, abnormal processing, WITH statement, record type declaration, class declaration, etc., when you encounter END or exit judgment, loop, exception handling, WITH sentence, record type declaration, Time to decrease the level when the class declaration is equal. For example: if Tmpint <> 100 THENTMPINT: = 100; 2.2 Begin..endbegin statement and END statement to exclusive one line in the source program, for example: for i: = 0 to 10 do begin // incorrect usage End; for i : = 0 TO 10 DO // The correct usage beginend; 2.3 Space adds a space on both ends of the operator and logic judgment symbol, for example: i: = i 1;, A and B, etc., but does not need space when adding parenthesis . For example: if (a> b) THEN // error Usage IF (a> b) The correct usage is, for example: Procedure Test (param1: integer; param3: string); 3. Object Pascal Syntax Writing format 3.1 Reserved Word Object Pascal language reserved words or keywords should be used to use lowercase letters. 3.2 Processes and Functions 3.2.1 Names and Format Processes and Functions The names of the function should be all consisting of meaningful words, and all the first letters of all words should use uppercase letters. For example: procedure formatharddisk; // incorrect naming procedure formatharddisk; // The correct naming setting variable content process and functions should be used as a prefix, for example: procedure setusername; read variable content processes and functions should be used As a prefix, for example, the parameter of the process and functions 3.2.2.1 Name the unified type of parameters are written in the same sentence: Procedure Foo (param1, param2, param3: integer; param4: string); 3.2. 2.2 Naming all parameters must be meaningful; and when the parameter name and other attribute name are heavy, add a prefix 'a', for example: procedure SomeProc (AUSERNAME: STRING; aUSERAGE: Integer); 3.2.2.3 Name conflict When using two Units, a renameful function or procedure is used, when you reference this function or process, the function or process in the Unit declared in the USE clause is executed. To avoid this 'Uses-Clause-Dependent' needs to write full functions or processes in the reference function or procedure. For example: sysutils.FindClose (SR); Windows.FindClose (Handle); 3.3 Variables 3.3.1 Variable Naming and Format First All variables must have meaningful names, so that other members can easily read the meaning representative of variables, Variable naming can use synonymous English name, you can use several English words, but the first letter of each word must be capitalized.

For example: VarwriteFormat :: string; at the same time, you can use a certain simultaneous call as follows: Pointer Type P Record Type REC array type ARR class Class cycle control variable usually uses a single character such as i, j, or k. Also use a meaningful name, for example: UserIndex is also permitted. 3.3.2 Local variables Use local variables in the process to follow naming rules for all other variables. 3.3.3 Global variables Try not to use global variables, if you have to use global variables, you must add the 'g', and the type of variable should be embodied in the variable name. For example: gprecuserCount: Point; // Name is a global variable of UserCount, which is a pointer to a structure but can use global variables inside the module. The global variable in all modules must be prefixed with 'f'. If you need to exchange between several modules, you need to be implemented by a method of declaring properties. For example: typeTFormOverdraftReturn = class (TForm) private {Private declarations} FuserName: string; FuserCount: Integer; Procedure SetUserName (Value: string); Function GetUserName: string; public {Public declarations} property UserName: string read GetUserName write SetUserName; property UserCount : Integer Read FuserCount Write FuserCount; End; 3.4 Type 3.4.1 Sizebook Protocol Reserved Type Name must be lowercase. The type of Win32 API is usually all uppercase. For other types of cases, the rest of the letter is uppercase, for example: varmystring: string; // reserved WordWindowHandle: hwnd; // Win32 API TYPEI: Integer; // type identifier introducesd in system unit3. 4.2 Floating-Point Types Try not to use the REAL type, he is just compatible with the old Pascal code, try to use the Double type. The Double type is optimized to the processor and data bus and is the standard data structure defined by the IEEE. When the value exceeds the range of Double, use extended. But Extended is not supported by Jave. But use Single types when using other languages. 3.4.3 Enumeration Type Enumeration Type The name must be meaningful and the name of the name is prefixed before. The name of the enumeration type must contain a shorthand of the enumeration type name, for example: tsongtype = (Strock, StClassical, StCountry, Stalternative, Stheavymetal, StrB); 3.4.4 An array type array type must have meaningful and type name Before you have prefix 't'. If a pointer to an array type must be prefixed before the name of this type, the 'p' is prefixed, for example: typePcycleArray = ^ TcycleArray; tcycleArray = array [1..100] of integer; 3.4.5 Recording Type Record Type of the name must It is necessary to add a prefix 't' before the name of the type.

If a pointer to an array type must be prefixed before the name of the name, for example: typePemployee = ^ TemPloyee; TemPloyee = RecordemPloyeename: StringeMployeeeerate: double; end; 3.5 class 3.5.1 Names and formatted names must It is necessary to add a prefix 't' before the name of the type. For example: TypetCustomer = Class (TOBJECT) class instance name is usually the name of the class of 'T'. For example: VARCUSTOMER: TCUSTOMER; 3.5.2 Variables in Class 3.5.2.1 Names and Formattes The names must be meaningful and the names of the name are prefixed before. All variables must be four. If you need to access this variable from an external variable, you need to declare an attribute 3.5.3 method 3.5.3.1 Name and format name and format with functions and procedures. 3.5.3.2 Property Access Method All Properties Access Method must appear in the private or protected. The name of the attribute access method is named after the function and process of the process, and the prefix 'Get' must be used with the write method (Writer Method) must use the prefix 'SET'. The parameters of the write method must be named 'Value', which is consistent with the attribute you want. For example: TSomeClass = class (TObject) privateFSomeField: Integer; protectedfunction GetSomeField: Integer; procedure SetSomeField (Value: Integer); publicproperty SomeField: Integer read GetSomeField write SetSomeField; end; 3.6 Properties 3.6.1 name and format of which was the same operation, The name of the variable of the class of the prefix 'f' is consistent. 3.7 File 3.7.1 Project Document 3.7.1.1 Project Directory Structure Program Oser Catalog - BIN (Path of the Application) -DB (the path where the local database) -DOC (the path where the document is located) -Backup (Backup Path) -tmp (Temporary File Path) 3.7.1.2 Name Project File must use a meaningful name. For example: project files for system information in Delphi are named sysinfo.dpr. 3.7.2 Form file 3.7.2.1 Name the name of the Form: For example: The name of the FormMain is formmain, the name of the FormMain.frm. 3.7.3 Data Module file 3.7.3.1 Naming Data Module files should make sense, and use 'DM' as a prefix. For example: User Data Module is named 'DMCUSTOMERS.DFM'. 3.7.4 Remote Data Module File 3.7.4.1 Naming Remote Data Module file should make sense, and use 'RDM' as a prefix. For example: User Remote Data Module is named 'RDMCUSTOMERS.DFM'. 3.7.5 Unit files 3.7.5.1 Normal Unit 3.7.5.1.1 Unit file Naming Unit files should be meaningful, and use 'unit' as a prefix. For example: General Unit is named 'UnitGeneral'. 3.7.5.2 Form Units 3.7.5.2.1 Name The name of the form unit file must be consistent with the name of the Form. For example: The main form is called formmain.pas, the name of the Form Unit file is: UnitFormMain.

3.7.5.3 Data Module Units 3.7.5.3.1 Name the name of the Data Module Unit file must be consistent with the name of Data Module. For example: The main Data Module called Dmmain.pas The name of the Data Module Unit file is: UnitdmMain. 3.7.5.4 File Headers should write the purpose of this file on the head of all files, authors, date, and inputs and outputs. For example: {modified: OF: Purpose: This module structures:} 3.7.6 Forms and Data Modules Forms3.7.6.1 Form 1. Form class naming standards Forms class category name should be meaningful, and the use of 'TForm' as Prefix. For example, the name of the About Form class is: Taboutform = Class (TForm) The name of the main form is TMAINFORM = Class (TFORM) 2. The name of the name of the name of the standard form of the Form class instance is the name of the 't''s FORM class. The name is consistent. For example:. Type NameInstance NameTaboutFormAboutFormTmainFormMainFormTCustomerEntryFormCustomerEntryForm3.7.6.2 Data Modules Form3.7.6.2.1 Data Module Form Naming Standard Data Modules Forms class should be meaningful, and the use of 'TDM' prefix. For example: TDMCUSTOMER = Class (TDATAMODULE) TDMORDERS = Class (TDataModule) 3.7.6.2.2. Data Module Instance Name Standard Data Module Form's class instance name should be the same as the name of the 't''s Data Module Form class. For example: Type NameInstance NametCustomDataModulectDataModuleDataModuleTAModule3.8 Control 3.8.1 An instance of a naming control instance should be used to remove the name of the 't' that control class as a prefix, for example: Enter the name of the TDIT of the user: editusername. 3.8.2 The name of the shorter control of the control can use the following shorthand, but the drug is added to the drug name between the drug is added to '_':

3.8.2.1 Standard Tab mm TMainMenupm TPopupMenummi TMainMenuItempmi TPopupMenuItemlbl TLabeledt TEditmem TMemobtn TButtoncb TCheckBoxrb TRadioButtonlb TListBoxcb TComboBoxscb TScrollBargb TGroupBoxrg TRadioGrouppnl TPanelcl TCommandList3.8.2.2 Additional Tab bbtn TBitBtnsb TSpeedButtonme TMaskEditsg TStringGriddg TDrawGridimg TImageshp TShapebvl TBevelsbx TScrollBoxclb TCheckListboxspl TSplitterstx TStaticTextcht TChart3.8.2.3 Win32 Tab tbc TTabControlpgc TPageControlil TImageListre TRichEdittbr TTrackBarprb TProgressBarud TUpDownhk THotKeyani TAnimatedtp TDateTimePickertv TTreeViewlv TListViewhdr THeaderControlstb TStatusBartlb TToolBarclb TCoolBar3.8.2.4 System Tab tm TTimerpb TPaintBoxmp TMediaPlayerolec TOleContainerddcc TDDEClientConvddci TDDEClientItemddsc TDDEServerConvddsi TDDEServerItem3.8.2.5 Internet Tab csk TClientSocketssk TServerSocketwbd TWebDispatcherpp TPageProducertp TQueryTableProducerdstp TDataSetTableProducernmdt TNMDayTimenec TNMEchonf TNMFingernftp TNMFtpnhttp TNM HttpnMsg TNMMsgnmsg TNMMSGServnntp TNMNNTPnpop TNMPop3nuup TNMUUProcessorsmtp TNMSMTPnst TNMStrmnsts TNMStrmServntm TNMTimenudp TNMUdppsk TPowerSockngs TNMGeneralServerhtml THtmlurl TNMUrlsml TSimpleMail3.8.2.6 Data Access Tab ds TDataSourcetbl TTableqry TQuerysp TStoredProcdb TDataBasessn TSessionbm TBatchMoveusql TUpdateSQL3.8.2.7 Data Controls Tab dbg TDBGriddbn TDBNavigatordbt TDBTextdbe TDBEditdbm TDBMemodbi TDBImagedblb TDBListBoxdbcb TDBComboBoxdbch TDBCheckBoxdbrg TDBRadioGroupdbll TDBLookupListBoxdblc TDBLookupComboBoxdbre TDBRichEditdbcg TDBCtrlGriddbch TDBChart3.8.2.8 Decision Cube Tab dcb TDecisionCubedcq TDecisionQuerydcs TDecisionSourcedcp TDecisionPivotdcg TDecisionGriddcgr TDecisionGraph3.8.2.9 QReport Tab qr TQuickReportqrs

d TQRSubDetailqrb TQRBandqrcb TQRChildBandqrg TQRGroupqrl TQRLabelqrt TQRTextqre TQRExprqrs TQRSysDataqrm TQRMemoqrrt TQRRichTextqrdr TQRDBRichTextqrsh TQRShapeqri TQRImageqrdi TQRDBMImageqrcr TQRCompositeReportqrp TQRPreviewqrch TQRChart3.8.2.10 Dialogs TabOpenDialog TOpenDialog SaveDialog TSaveDialog OpenPictureDialog TOpenPictureDialog SavePictureDialog TSavePictureDialog FontDialog TFontDialog ColorDialog TColorDialog PrintDialog TPrintDialog PrinterSetupDialog TPrintSetupDialog FindDialog TFindDialog ReplaceDialog TReplaceDialog 3.8.2.11 Win31 Tab dbll TDBLookupListdblc TDBLookupCombots TTabSetol TOutlinetnb TTabbedNoteBooknb TNoteBookhdr THeaderflb TFileListBoxdlb TDirectoryListBoxdcb TDriveComboBoxfcb TFilterComboBox3.8.2.12 Samples Tab gg TGaugecg TColorGridspb TSpinButtonspe TSpinEditdol TDirectoryOutlinecal TCalendaribea TIBEventAlerter3.8.2.13 ActiveX Tab cfx TChartFXvsp TVSSpellf1b TF1Bookvtc TVTChartgrp TGraph3.8.2.14 Midas Tab prv TProvidercds TClientDataSetqcds TQueryCli ENTDataSetDcom TDCOMCONNECTIONOLEEEEnterpriseConnectionsck TsocketConnectionRMS TremoteServermid TMIDASCONNECTION4. Modifying the specification The provisions made by this rule apply only to programs that have been included in configuration management. In such modifications, the content pre-modified and identifies the modifications and new content. And the necessary information such as the file header is added to the modification, modify the date, modify the description. 4.1 Modifying the history of the history file When the source file is approved, the modifier shall add the modified historical item in the program file header. When each modification will be modified in the future, the modifier must fill in the following information in the project: Modifying the modification time modification CAUSE Modification Description How to modify 4.2 New Code row's new code row should be annotated. // Modify the person, modify the time, and modify the new code row // Modify End 4.3 Delete the code row to delete the front and rear of the code row. / / Modify the person, modify the time, modify the instructions // The code row to be deleted (the statement to be deleted) // Modify the end 4.4 Modify the code line to modify the code line to delete the code line after the new code line get on. // Modify the person, modify the time, modify the instructions // Modify the code row // modified end // The modified code line modified code row // modified end data finishing: Programming Pioneer http://wlbookwl.myrice. COM webmaster: small black man

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

New Post(0)