|
NIST
TRAINING & CONSULTANCY SERVICES |
| HOME >> FOCUS AREA >> S/W ENGINEERING >> QUALITY CONTROL |
Starting from designing to maintenance of a software application package, few standards need to be followed at all stages of the software development. Among all the phases the implementation phase of software development is concerned with translating design specifications into source code. The primary goal of implementation is to write source code and internal documentation so that conformation of the code to its specifications can be easily verified. This goal can be achieved by making the source code as clear and straightforward as possible.
* Simplicity clarity and elegance are the hallmark of good programs.
Source-code clarity is enhanced by structured coding techniques, by good coding style, by appropriate supporting documents, by good internal comments, and exploiting the features provided in modern programming languages.
Production of high quality software requires:
*Those who write clearly have readers, those write obscurely have commentators
To enhance the source code clarity and that of the end product we have what is known as structured coding techniques and coding standards for a preferred coding style. The quality of the end product can be improved by specifying the various guidelines to be followed while coding, the naming conventions to be used, and the form, report, and screen layout.
* A good workman is known by his tools
1.1 Coding Standards and Its ImportanceCoding standards are sometimes ridiculed by developers who think that what they write should be obvious to everyone. But good structure, proper naming and appropriate commenting can provide an outline of the code. The advantages of following good coding standards are as follows:
* Keeping the program simple is advisable but not stupid
1.1.1 Commenting for clarity
Adding comments can ease the task of finding bugs and correcting them, better understanding of the code by the programmer for future reference, make modifications as and when required. Comments provide an outline of the code and to describe the purpose of the code. Comments should be added to answer "what" and "why" but not "how": Comments can be added to a program at various stages as follows:
* Commenting is the engine oil of programming
1.1.2 Structured routines
Giving some structure to routines can improve the readability and clarity of the code. Few of the measures to be taken are as follows:
* A computer program does what you tell it to do, not what you want it to do
1.1.3 Variable scope minimization
Scope is used to describe the extent to which a variable can be seen in an application. We can have global or public scope if it can be accessed to all the routines in a project or local or private scope if it is only visible to the module. It is best to use the smallest scope possible for a variable.
* Global variables are most dangerous sources of untraceable bugs
1.1.4 Syntax standards
Syntax standards make the application code more consistent and ensure that all the programmers involved in a project follow the same standards.
* A hidden flaw never remains hidden
1.1.5 Error Handling
A coding standard for error handling should include three steps:
* To err is human, but not able to detect is a blunder
1.1.6 Input Validation:
Validation of the input is a must and is an important aspect of any software. All the inputs accepted form the user should be validated properly before storing it into the actual database. If no validation will be carried out then the database will be consistent and may not work properly.
1.2 Coding Style and Its Importance
The highlights of good coding style are:
goto in a controlled manner
(avoid totally if possible)The highlights of good coding style are: use of few standard agreed upon control constructs
goto in a controlled manner
(avoid totally if possible)The donts of good coding style are:
* Elegance is preferred, but not at the cost of performance
1.3 Naming Standards and Its Importance
Naming conventions provide readable, memorable and unambiguous names to help developers read and maintain software applications. It helps the software developer to know what is the type and purpose of the variable used. Few general guidelines on naming are as follows:
* The name should at least specify the purpose
Naming Standards
4.1 Standards in Naming
Proper naming standards should be followed for objects, routines and variables. Object naming conventions make it easy to recognize which object is used and for what purpose. Constant variable naming conventions differentiate constant variables from the normal variables. Naming can be divided into the categories as shown below.
4.2 Object Naming Conventions
| Control Type | Prefix | Example |
| Collections | col | colStudents |
| Check box | chk | chkReadOnly |
| Combo box | cbo | cboTask |
| Command button | cmd | cmdCancel |
| Common dialog | dlg | dlgFile |
| Command object | cmm | cmmName |
| Connection object | cnn | cnnPerson |
| Coolbar | cbr | cbrMain |
| Data control | dat | datTask |
| Database | db | dbConnect |
| Directory list box | dir | dirSource |
| Drive list box | drv | drvTarget |
| DTPicker | dtp | dtpCurrent |
| File list box | fil | filSource |
| Form | frm | frmMain |
| Frame | fra | fraOptions |
| Grid | grd | grdItems |
| Horizontal scroll bar | hsb | hsbScroll |
| Image | img | imgLogo |
| Label | lbl | lblRoll |
| Line | lin | linColor |
| List box | lst | lstItems |
| List view | lvw | lvwSubject |
| Menu | mnu | mnuMain |
| Month view | mvw | mvwPeriodStart |
| Multimedia | mul | mulFilm |
| MSHFlexGrid | flx | flxStudent |
| Option button | opt | optYes |
| Picture box | pic | picMain |
| Rich text box | rtf | rtfInformation |
| Recordset | rs | rsPerson |
| Shape | shp | shpCircle |
| Spin control | spn | spnAge |
| Status bar | sta | staForm |
| Text box | txt | txtName |
| Timer | tmr | tmrAlaram |
| Tree view | tvw | tvwDirectory |
| Vertical scroll bar | vsb | vsbPage |
4.3 Module Naming Conventions
Module name depends on the type of the module. The module naming standards to be followed are as follows:
M
like MMaincls
like clsMarks4.4 Routine naming conventions
Routine naming conventions to be followed are as follows:
<object>_<verb>
formatExamples:
Class_Terminate, txtName_Click, frmMain_Load
Examples:
ReadFile,WriteFileall private routines should follow the <
object><verb>syntaxExamples:
FileOpen,FileClose
4.5 Menu naming conventions
The menu naming standards to be followed are as follows:
4.6 Variable Naming Conventions
The variable naming convention to be used is that of Hungarian naming convention frequently used in C and many other high level languages. This notation includes a prefix and a body. The prefix describes the scope and the data type of the variable. The body should specify the purpose of the variable. The prefixes to be used for variables of different type and scope are as follows.
4.6.1 Variable type, scope and the prefixes to be used
| Type/Scope Description | Prefix |
Example |
| Array | a |
aNames |
| Boolean | b or bIs |
bYesNo, bIsValid |
| Byte | byt |
bytNum |
| Currency | cur |
curAmount |
| Date+Time | dt |
dtToday |
| Double | dbl |
dblTotAmount |
| Error | err |
errMessage |
| Float/Single | f |
fTaxPer |
| Integer | I |
iRollNum |
| Long | l |
lTotMarks |
| String | s |
sName |
| User defined data type | udt |
udtHallNum |
| Variant | v |
vUserDesc |
| Global or public | g_ |
g_UserID |
| Module level | m_ |
m_DataItem |
4.7 Table and its Attributes Naming Conventions
Table and its attribute naming should follow the standards as shown below:
Example: If the table name is "Student" then an attribute for specifying the roll of the student should be "STRollNum".
Coding Standards18.1 Commenting Standards
The commenting standards to be followed at various stages are as follows:
Class Name: clsStudent
Type: Entity class
Description: Student entity class
Author: Manoranjan Mishra
Date: 22/08/2000
Modified by: Rajendra Nanda
Date of Modification: 24/08/2000
Purpose of Modification: Addition of new routine
Function: GetElapsedTimeDescription: It returns a number specifying the number of seconds since the system was started. And has better resolution. Source: "Visual Basic
Source Code Library--BRIAN SHEA, ET AL.,
Page-16".
Prototype: GetElapsedTime() As SingleParameters: NoneReturn Type: SingleLimitation: NoneAuthor: Samita BhuyanDate: 31-10-2000
Tested By: Manoranjan Mishra and Samita Bhuyan
Date of Test: 03-11-2000
Modified by:
Date of Modification:
Purpose of Modification:
All the parameters and the return type should be followed by one line description of the purpose of the parameter
18.2 Programming Standards
The programming standards to be followed are as follows:
option explicit" should
be set at the module level to enforce explicit declaration of all variables in the moduleExample: Instead of using
"Screen.Mousepointer = 11", "Screen.Mousepointe = vbHourglass"should be used.
18.3 Syntax Standards
Syntax standards make the application code more consistent and ensure that all the programmers follow the same standards. The standards to be followed are as follows:
Example: Dim a, b, c, As String.
This line appears to be declaring three variables of type string but it actually declaring the first two variables, i.e., as of type variant and only the last variable, i.e., as of type string.
These are the checklist which should be used by the project desighners, code designers,Quality checking & testing people. for quality checking.
Click hare to downloads checklist forms
Table of Checklists
1 |
Defect Report |
2a |
Change Request Form |
2b |
Change Impact Form |
3 |
Use Cases and Scenarios Specification Checklist |
4 |
Technical Dictionary Checklist |
5 |
Use Case Implementation Checklist |
6 |
Class Definitions Checklist |
7 |
Form/GUI Testing Checklist |
8 |
Report Design Checklist |
9 |
Interface Navigation Chart Checklist |
10 |
Data Dictionaries Checklist |
11 |
Class Code Checklist |
12 |
Class testing Checklist |
13 |
Form Code Checklist |
14 |
Form Testing Checklist |
15 |
Report Testing Checklist |
16 |
Module Integration Testing Checklist |
17 |
Deployment Testing Checklist |
18 |
Beta Testing Report |
| HOME >> FOCUS AREA >> S/W ENGINEERING >> QUALITY CONTROL |
NIST
|| NISTinfo || Terms
of Use || Site Map || Contact Us
Copyright © NTCS,
Berhampur,2002