Code Commenting Conventions in Visual Basic 6

Spread the love

While programming comments are very useful. As these help the current development and the future development of the program. Comments should provide the clear picture of procedure or variable declaration.

A comment should have following sections for procedure

 Section Heading  Comment Description
 Purpose  What the procedure does
 Assumptions  List of each external variable, control, open file, or another element that is not obvious.
 Effects  List of each affected external variable, control, or file and the effect it has (only if this is not obvious)
 Inputs  Each argument that may not be obvious; arguments are on a separate line with inline comments
 Returns  Explanation of the values returned by functions

E.g.
‘*************************************************************
‘ procedureName()
‘ Purpose: Sum of two numbers
‘ Inputs: a , b – the two values to be summed
‘ Returns: The sum of two numbers
‘*************************************************************

It’s particularly important to list all the global variables a procedure uses or affects in this initial comment block.