Program design specification (reproduced)

zhaozj2021-02-11  215

Procedure set

1. Naming rules for folders and files

1.1 folder naming

1 Establish a corresponding folder based on the structure specified in the system design, establish a subfolder as needed

2 The name of the folder should be as expected to express its meaning, try to use English name, absolutely unable to Chinese characters

3 folder name must be used to use lowercase letters (such as "/ example")

1.2 file name

1 The name of the file should be as best as possible, try to use English name, absolutely can't happen

2 file names all use lowercase letters (ensure platform compatibility)

3 File names generally use the "xxx_yyy.ext" format, XXX (3-4 letters) indicate classification, YYY (alphabet self-qualified) means operation (such as "/example/exp_edit.htm)

2. Program writing rules

2.1 variable naming

All variables must be able to reflect the role of variables, using the following naming rules:

(1) constant naming conventions

Create a true constant with a const statement. This convention uses cases in which case mixed format, and "con" as a constant name. E.g:

ConyownConstant

(2) Variable naming conventions

For easy reading and consistency, use the following variable naming conventions in the VBScript code:

Types of

Prefix

Example

Boolean

BLN

BLNFound

Byte

BYT

Bytrasterdata

Date (Time)

DTM

DTMSTART

Double

DBL

DBLTolerance

Error

Err

ErrorDernum

Integer

int

IntQuantity

Long

LNG

LNGDISTANCE

Object

Obj

Objcurrent

Single

SNG

Sngaverage

String

Str

Strfirstname

(3) variable scope prefix

As the length of the Script code is increased, it is necessary to quickly distinguish the scope of the variable. Add a single-character prefix in front of the type prefix to achieve this without causing the variable name too long.

Scope

Prefix

Example

Process grade

no

DBLVELOCITY

Script level

s

SBLncalcinProgress

Full-scale

G

GblncalcinProgress

⑷ Descriptive variable name and process name

The subject of the variable name or process name should use the case in cases, and the purpose is intended to be integrated as possible. In addition, the process name should begin with verb, such as initNameArray or Closedialog. For frequently used or longer names, standard abbreviations are recommended to keep the name within the appropriate length. Metades typically be more than 32 characters will become difficult to read. When using abbreviations, be sure to be consistent throughout Script.

Object Naming Convention, the following table lists the object naming conventions (recommended) that may be used in VBScript:

Object type

Prefix

Example

Text box

TXT

TXTLASTNAME

List box

lin

linVertical

Check box

chk

ChkReadonly

Combo Box,

Drop-down list box

CBO

Cboenglish

label

LBL

lblhelpMessage

Command button

cmd

cmdexit

frame

FRA

Fralanduage

image

IMG

IMGICON

straight line

LST

LstpolicycoDes

Public dialog

DLG

Dlgfileopen

Horizontal scroll bar

HSB

HSbvolume

Vertical scroll bar

VSB

vsbrate

⑸ Code Notes

The beginning of all processes should have a brief comment describing its functions. When the use of parameters passing to the process is not obvious, or when the process requires the value of the value of the parameters, it should be explained. If the process changes the return value of the function and the variable (especially through the parameter reference), the return value should also be described at the beginning of the process. The annotation of the process start section should contain the following segments. For related samples, see the "Format Code" section later.

Section title comment

The function of the destination process (not a method of implementing the function).

Suppose its state affects the list of external variables, controls, or other elements of this process.

A list of effects effects on each external variable, control or other element.

Enter the explanation of the parameters of each purpose. Each parameter should occupy a separate line and have its internal annotation.

Returns the explanation of the return value.

Remember the following points:

Each important variable declaration should have internal annotations and describe the use of variables.

The variables, controls, and processes should be clearly named, which requires internal annotations only when explaining complex details.

The beginning of Script should include an overview describing the Script, an object, a process, an algorithm, a dialog, and other systems from the base. It is useful to have a false code of the description of the algorithm.

Formatting code

The screen space should be reserved as much as possible, but the logical structure and nested are still allowed. Here is a few tips:

Standard nesting blocks should be indented into 4 spaces.

Overview of the process Note Should be indented into 1 space.

Overview The highest layer statement after comments should indent 4 spaces, and each layer is nesting into 4 spaces. E.g:

'********************************************************** *********

'Purpose: Returns the location where the user will appear in the UserList array.

'Enter: struserlist (): The list of users found.

'Strtargetuser: The user name to find.

'Return: Strtargetuser's index when the StruserList array appears.

'If the target user is not found, return -1.

'Date: Designed by MS 2000/9/12

'********************************************************** *********

Function intfinduser (StruserList (), StrtargetUser

DIM I 'cycle counter.

DIM BLNFOUND 'discovers the mark of the target.

INTFINDUSER = -1

i = 0 'Initializing the loop counter.

Do While i <= ubound (struserlist) and not blnfound

IF struserlist (i) = startergens

BLNFOUND = True 'marks set to True.

The INTFINDUSER = I 'return value is set to a loop counter.

END IF

i = i 1 'circular counter plus 1.

Loop

END FUNCTION

2.2 Common Library

1 All public function files are placed in the "/ include" directory, unified management, and make appropriate categories and adjustments

2 All public functions must write function functions, parameter definitions, and return values ​​before the function, parameter definition, and return value, for example:

2.4 Notes

1 Note Try to use Chinese as much as possible

2 Each program must have the following notes:

Program name, program description, implementation, designer, design date

3 The program code section must have enough information about the code snippet, express the written intent and implementation principle of the program fragment.

2.5 program structure

1 There is enough fault tolerant handling function in the program code

2 Reporting Programs and Query Programs should be flexible, try to provide users with sufficient selection 3 The program code structure must be clear, properly use the blank segmentation

3. Interface design rules

1. Interface design is as beautiful, practical, unified

2. Interface design should try to refer to the advice of the art

4. Test rules

1. After the program is written, the necessary tests should be performed.

2. Test cases To overwrite each functional module.

---

thank you for your help

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

New Post(0)