-
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.
Global Variables Configuration and inter-subroutine communication is done using global variables. Variables should be named Qvc.component.v.name For example: 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 preceeded by “”. For example: _Qvc.Loader.v.QvdFile Global variables must be deleted (nullified) in Qvc.Cleanup. Only variables definitely useful to the UI should persist.
Local Variables 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. For example: _tableName Local variables created in a SUB should be named with a leading “_qvctemp.”For example: _qvctemp.nextValue Local variables must be deleted (nullified) at the end of the sub using a SET. For example: SET _qvctemp.nextValue =; (TODO is this good enough or should we introduce a reserved _qvclocal.* to not collide with user names?)