-
Notifications
You must be signed in to change notification settings - Fork 98
Programming Conventions
The QVC source code is divided into components to help make it easier to understand and maintain. The component files are named: Qvc_Component.qvs
All names (except for local variables) should use capitalized full spellings with no spaces and no abbreviations.
- Examples:
BaseData
PrimaryKey
Acronyms may be used but only the first letter should be capitalized.
- Examples:
Qvd
Html
QvdFilename
All externally visible API components; subroutines, functions, variables – will begin with the namespace prefix “Qvc.”
- Subroutines:
Qvc.function
Examples:
Qvc.Log
Qvc.FileExists
Any member preceded by “_” is private to Qvc. It should not be referenced by user script.
Configuration and inter-subroutine communication is done using global variables. Variables should be named Qvc.component.v.name
- Examples:
Qvc.Log.v.LogFilename
The component portion of the name generally matches the subroutine name. However, in some cases, a more general name is used when the variable is used by one or more subroutines.
Any variable preceded by “_” is private to Qvc. It should not be referenced in user script.
Private global variables are used to communicate between routines or to maintain state between calls of the same routine. Private globals should use the 'Qvc.*' convention preceded by “_”.
- Examples:
_Qvc.Loader.v.QvdFile
Global variables must be deleted (nullified) in Qvc.Cleanup. Only variables definitely useful to the UI should persist.
Parameter variables automatically have local scope and will not exist outside the SUB. Therefore there is no need to worry about name collisions. It is recommended that parameter variables be named with a leading “_” to clearly note that they are local variables.
- Examples:
_tableName
Local variables created in a SUB should be named with a leading “_qvctemp.”
- Examples:
_qvctemp.nextValue
Local variables must be deleted (nullified) at the end of the sub using a SET.
- Examples:
SET _qvctemp.nextValue =;
It is currently under discussion as to whether this is good enough or whether a reserved _qvclocal.*
should be introduced to prevent collision with user names.
All temporary tables and fields should be prefixed with the leading “_qvctemp.”
- Examples:
_qvctemp.TableName:
LOAD FieldName AS _qvctemp.FieldName FROM ....
In case the user has called QUALIFY *;
in the script prior to making the subroutine call, UNQUALIFY "_qvctemp.*";
should be called before loading any temporary tables.
True/False values should be set as -1/0, not True()/False().