Paradox Community
Search:

 Welcome |  What is Paradox |  Paradox Folk |  Paradox Solutions |
 Interactive Paradox |  Paradox Programming |  Internet/Intranet Development |
 Support Options |  Classified Ads |  Wish List |  Submissions 


Paradox Programming Articles  |  Beyond Help Articles  |  Tips & Tricks Articles  


Paradox For Windows Naming Conventions
© 2001 J. Eric Taylor

Introduction

The naming conventions listed here are an adaptation of the conventions suggested by the books Paradox For Windows Applications by Bill Todd and Code Complete by Steve McConell. A suffix based naming convention works well for our firm. If your experience has been primarily with Hungarian notation, you may prefer to adapt these conventions to a prefix based system ( instead of suffix ) of your own.
"The most important consideration in naming a programming item is that the name fully and accurately describe the entity and/or the variable represents. Entity names should be readable, memorable and appropriate." (paraphrased)
- Steve McConnell, Code Complete

Variables and Constants

Intercaps with first letter capitalized will be used with variables and constants. Special characters and numbers are discouraged. Variable and Constant names of more than 16 characters will not be uncommon using these guidelines.

Variables and constants will end with a suffix to reflect their position in the container hierarchy.

Level Variable Constant Example
Application _AV _AC ApplicationNameStr_AC
Global _GV _GC FormNameStr_GV
Persistent _PV _PC PageNameStr_PV
Object _OV _OC PushButtonStr_OV ( UIObject )
Private none none  

All global variables and constants will be labeled "Global". They will have the suffix of " _GV " or " _GC " Private variables and constants will have no special suffixes. Always use Persistent Variables and Constants scoped to the object before considering global variables.

Avoid global variables where ever possible!

Persistent variables are declared above the method. Once assigned the persist for the life of the object.

Use constants as much as possible to make code changes easier and faster to manage. Initialize variables in the built-in Init or Open methods whereever possible.

ThisFormStr_GV Variable available to all methods ( global ) in the current file
FormTitleStr_GC Constant available to all methods ( global ) in the current file
HotKeyAry_GV Array available to all methods ( global ) in the current file
TableNameStr_OC Constant available only to methods in the current UIObject
TableStr Variable available ( private ) only to the current method

Variable Naming Conventions

Variable Suffix Example
Anytype ANY MyCupAny
Application APP CurrentApp
Array ARY OpenFormsAry
Binary BIN BMPFileBin
Constant C FormTitleStr (+ "_GC " when global)
Currency $ TotalExpense$
DataBase DB ActiveDb
DataTransfer DTR ImportDtr
Date DAT NewDat
DateTime DTM CurrentDtm
DDE DDE ProgmanDDE
Event EVN StatusEvn, MenuEvn, ActionEvn
DynArray DYN GoToLastDyn
FileSystem SYS FileSys
FileBrowerInfo FBI BrowserFbi
Form FRM MainFrm
Graphic GRC PhotoGrc
Index NDX TableNdx
Library LIB SystemLib
Logical LOG ActiveLog
LongInt LNG SerialNumLng
Memo MEM CommentsMem
Menu MNU MainMnu
Number NUM SerialNum
OLE OLE WordOLE
Point PNT MousePnt
PopUpMenu POP UserPop
Query QBE AutoQBE
Record REC SelectedRec
Report RPT PreviewRpt
Script SPT RunMeSpt
Session SES CurrentSes
SmallInt SMI SequenceSmi, LoopSmi, CounterSmi
SQL SQL ResideSQL
String STR NamesStr
System STM CurrentStm
Table TBL SourceTbl
TableView TV AnswerTV
TCursor TC ScanTC
TextStream TSM NewFileTsm
ToolBar BAR CustomBar
Time TIM StartTim
UIObject UIO ActiveUIO
UserMenu UMU KeepFormOpenUmu
User-Defined UDT ColumnNameUdt


Uiobject Naming Conventions

Uiobject Suffix Example
Field FLD FirstNameFld
Button BTN CancelBtn
Box BOX OuterBox
Text Txt LabelTxt
TableFrame TF AnswerTf
Page PG PageOnePg
NoteBook NB UserNb
NotePage NPG NotePageOneNpg
MultiRecord MR MailLabelMr
CrossTab Ctb RaceGenderCtb
Graph Grf RaceGrf
Graphic IMG PhotoImg
Elipse Elp LogoElp
Line LIN TopLin
List LST FileNameLst


Fields

Naming fields in a table correctly improves software ease of use and reuse just as much, if not more, than naming conventions applied to variables and Uiobjects. All fields will begin with a three letter prefix, all in capitol letters, indicating the table to which they belong. It is acceptable to end the field name with a three letter suffix, based on the variable naming conventions listed above, to indicate the data type of the field. Intercaps will be used throught the various names. Field names of more than 16 characters will not be uncommon using these guidelines.

Formula: Table Name + Field Name + Data Type

Field Naming Conventions

Table Prefix Datatype Suffix Example
Vehicle.Db VEH Alpha Str VEHMakeStr
Vehicle.Db VEH SmallInt Smi VEHYearSmi
Invoice.Db INV Number Num INVInvoiceNum
Invoice.Db INV Fmt. Memo Fmo INVRemarksFmo
Invoice.Db INV LongInt Lng INVSecondaryKeyLng


Custom Methods

Custom methods will be named with a strong action verb followed by the object of the action verb and finally with the datatype the custom method returns. If a custom method does not return a data type then the suffix will be Nil.

Formula: Action Verb + Object of Action + Returned Data Type

OpenFormOnce_Nil Opens a single instance of a form and return NO value
ExtractLastName_Str Extracts last name from a string and returns last name as a string
CalculateAge_Smi Calculates current age based on D.O.B. and returns a SmallInt
GetBoxPosition_Num Get the position of a box and returns a number


Position Variables

Variable Datatype Explanation
ContainerUio UIObject ; Container to center object in
TargetUio UIObject ; Object to be centered in container
ContainerXposLng LongInt ; Container X position
ContainerYposLng LongInt ; Container Y position
ContainerHeightLng LongInt ; Container height
ContainerWidthLng LongInt ; Container width
TargetXposLng LongInt ; Object X position
TargetYposLng LongInt ; Object Y position
TargetHeightLng LongInt ; Object height
TargetWidthLng LongInt ; Object width
NewXposLng LongInt ; Object X position after centering
NewYposLng LongInt ; Object Y position after centering


Discussion of this article


 Feedback |  Paradox Day |  Who Uses Paradox |  I Use Paradox |  Downloads 


 The information provided on this Web site is not in any way sponsored or endorsed by Corel Corporation.
 Paradox is a registered trademark of Corel Corporation.


 Modified: 15 May 2003
 Terms of Use / Legal Disclaimer


 Copyright © 2001- 2003 Paradox Community. All rights reserved. 
 Company and product names are trademarks or registered trademarks of their respective companies. 
 Authors hold the copyrights to their own works. Please contact the author of any article for details.