The order in which the meticulin is mainly considering the register call rule. The most common parameters should be used as the first parameter, follow the left to right rows according to the frequency of use. The input parameter is before the output parameter. The large parameters should be placed before the range of small parameters. For example: S O m E P R o c (A P L A N E T, A C O N N e N T, A C O U N T R Y, A S T A T E, A C I T Y). Some of the exceptions. For example, during an event processing, the SE B J E C T type S E N D E R parameter is often the first parameter to be passed. ---------------------------------- When the two units contain the same name, if the call This routine actually calls the routines in the unit that appear later in the Uses clause. To avoid this, you can add the desired cell name before the method, for example: s ys u tils. F Ind c Lose (SR); or Wi NDOWS. F Ind c Losr (h ANDLE); ----- ------------------------------------- global data can be directly initialized to a value when declaring. Note that all global variables are automatically initialized, so do not initialize global variables as null values such as 0, N i L, or U N A S I g n D. ------------------------------------------ Do not encourage the use of R EAL, because It is just in order to be compatible with old P ASCAL code. Normally, D O U B L E should be used for floating point numbers. D O U B L E can be optimized by the processor, which is the standard data format defined by I E E E. When the range is required to be larger than the range provided by D O U B L E, e x t e n d can be used. E x t e n D is the type of I n t e l, J a v A does not support. When the number of physical bytes of floating point variables are important (may be written in other languages), you should use S INGL E ---------------------- ------------------- 3. Enumerated enumeration type name must represent the purpose of enumeration. The name should be plus T characters as a prefix before the name, indicating this is a data class ------------------------------------------------------------------------------------------------------------------------ ------ The array type name should express the use of the array. Type names must add letter T to prefix. If you want to declare a pointer to the array type, you must add letter P to prefix, and the declaration is before the type declaration. For example: TYP EP C Ycle a ray = ^ TC Ycle a ray; tcycleArray = array [1..100] of integer; ----------------------- ------------------ The array type name should express the use of the array. Type names must add letter T to prefix. If you want to declare a pointer to the array type, you must add letter P to prefix, and the declaration is before the type declaration. For example: TYP EP C Ycle a ray = ^ TC Ycle a ray; tcycleArray = array [1..100] of integer; ----------------------- ------------------- The Case Statement
Case I of 1..5: CAPTION: = 'low'; 6..9: caption: = 'high'; 0, 10..99: CAPTION: = 'Out of Range'; Else Caption: = ''; End; Is Equivalent to the Nested Conditional
IN [1..5] Then Caption: = 'Low' Else IF I in [6..10] Then Caption: = 'high' else IF (i = 0) OR (i in [10..9] ) THEN CAPTION: = 'Out of Range' else Caption: = '';
Other Examples of Case Statements:
Case mycolor of red: x: = 1; Green: x: = 2; Blue: x: = 3; Yellow, Orange, Black: x: = 0; End; Case Selection of Done: form1.close; compute: CalculaTotal Unitcost, quantity; else beep; end; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -) Virtual Method and Dynamic Method When you want a method to be derived, you should use a virtual method. If the class method is used directly or indirectly by multiple derived classes, the dynamic method should be used. For example, a certain class contains a frequently covered method and has 1,0 0 assignments, and the method should be defined as dynamic, which can reduce the overhead of memory. (4) Abstract method If a class is to create an instance, do not use the abstraction method. Abstract ------------------------------------------ The name of the data module file should be expressed The effect of the data module and has a DM suffix. For example, the file name of the C u s t o m e R s data module is called C u S T O M E R S D m. D fm. ------------------------------------------ Don't place time in I nitialization part A lot of code. Otherwise, it will cause a very slow when the application starts. ------------------------------------------ Finalization part Make sure all in I Nitialization The resources allocated in the section. ------------------------------------------ Copyright @ Year by Authors} - --------------------------------------- All source files and project documents should have files head. A correct file header should include the following information: {Copyright @ Year by authors} --------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------- The name of the form unit file is the same as the corresponding form name. For example, the unit name of the A b O U T form is called A B O U T F R M. P. The unit file name of the main form is called A B O U T F R M. P. 3. The name of the data module unit data module unit file is the same as the corresponding data module name. For example, the name of the data module unit is called C U S T O M. P a S. 4. The name of the universal unit universal unit should express its use. For example, the name of a utility unit is called U g u t Il i t i e s. P A S, the unit name containing global variables is called C U S T O M E R G L O B A L s. P. Note that the unit name in a project must be unique. The general unit name cannot be renamed. 5. The component unit 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. ------------------------------------------ unless special reasons, only the main form Automatically generate it. All other forms must be removed from the Automatic generation list of the Project Options dialog -------------------------------- ------ Component unit can only contain one main component, which is the component that is now on the component palette. Other auxiliary components or objects can also be included in the same unit. 3. The registration process of the registration unit component should be removed from the component unit and placed in a separate unit. This registration unit is used to register all components, attribute editing, component editing, wizard, and more.
Component registration should be carried out in the design period. Therefore, the registration unit should be included in the design period rather than the running period. It is recommended to name the registration unit: X x r e g. P a s where x x x is 3 characters prefixes to identify companies, individuals, or other entities. For example, the registration unit in this book is named D D G R E G. P A S. --------------------------------------------------------------------------------------------------------------------------------------------- Similar to the name of the class, it only has 3 characters prefixed. These prefixes are used to identify companies, individuals, or other entities. For example, a clock component can declare this: T D D g C L o C k = C L A S s (T C O m P O N e n) Note that three characters as a prefix should be lowercase. 2. The component unit component unit can only contain one main component, which is the component that is now on the component option board. Other auxiliary components or objects can also be included in the same unit. ------------------------------------------ if Password <> CorrectPassword then raise EPasswordInvalid .Create ('incorrect password entered "); ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Begin ListBox1.Items.Add ('a string'); {add a string to list box} listbox1.items.add ('annother string'); {add another string ...} listbox1.items.add (' still another string '); {... and a third string} try Caption: = ListBox1.Items [3]; {set form caption to fourth string} except on EStringListError do ShowMessage (' List box contains fewer than four strings') ; End; End; ------------------------------------------ or esample, Consider The Following Declaration:
TYPE EMYEXCEPTION = Class (Exception);
If you raise EMyException but do not provide a specific handler for it, a handler for Exception (or a default exception handler) will still handle it. Because the standard handling for Exception displays the name of the exception raised, you can see that it Is Your New Exception That Is Raise.