Page 1 of 6
Naming Conventions
Posted: Tue Jul 27, 2010 12:57 pm
by melliott42
Hello all,
As a convention what do yo like to use for PUBLIC variables?
I use the following for LOCAL variables:
Code: Select all
cMyVar = String\Character
nMyVar = Number
lMyVar = Logical
dMyVar = Date
Thanks,
Michael
Re: Naming Conventions
Posted: Tue Jul 27, 2010 2:12 pm
by esgici
Hello Michael
As a (very old

) convention, I'm using yours for all variable, without differentiate its scopes.
With HMG, I begun prefixing control
names with its kind:
frm : Form,
txb : Text box,
chb : Check box,
lsb : List box,
btn : Button,
etc ...
Me too, time to time I need know scope of variables. So, may be useful prefixing such as : ( while "x" for type ( a, c, d, l, n ) )
xpb : public
xpr : private
xst : static
xlo : local
fe :
apb : public array,
cpr : private character,
nlo : local numeric,
dlo : local date,
etc ...
IMHO type is more important than scope, best place is beginning of.
Thanks to start this topic
Regards
--
Esgici
Re: Naming Conventions
Posted: Tue Jul 27, 2010 2:25 pm
by melliott42
Esgici,
Thanks for posting.
IMHO type is important than scope, best place is beginning of.
I feel exactly the same. I think this is overlooked all to often in naming conventions.
Re: Naming Conventions
Posted: Tue Jul 27, 2010 2:36 pm
by melliott42
Is it true that all Clipper\HMG variables for arrays are PUBLIC variables?
Re: Naming Conventions
Posted: Tue Jul 27, 2010 2:41 pm
by melliott42
Another type too is distinguishing a FUNCTION parameter.
Re: Naming Conventions
Posted: Tue Jul 27, 2010 2:55 pm
by esgici
melliott42 wrote:Is it true that all Clipper\HMG variables for arrays are PUBLIC variables?
For Clipper :
IMHO NO !
But arrays always passed by reference.
For HMG :
Sometimes

Me too, I don't know exactly WHEN ?
Regards
--
Esgici
Re: Naming Conventions
Posted: Tue Jul 27, 2010 2:57 pm
by esgici
melliott42 wrote:Another type too is distinguishing a FUNCTION parameter.
As far as I remember, all variables come to (accepted by) a function ( or a procedure of course ), are LOCAL.
Regards
--
Esgici
Re: Naming Conventions
Posted: Tue Jul 27, 2010 4:26 pm
by melliott42
Here is a nice take on HMG related naming conventions too:
http://members.casema.nl/r.vd.boom/CodStdCl.htm
Re: Naming Conventions
Posted: Tue Jul 27, 2010 4:35 pm
by esgici
Good source, thanks Michael
Regards
--
Esgici
Re: Naming Conventions
Posted: Tue Jul 27, 2010 5:38 pm
by melliott42
Can anyone suggest a compelling reason to use single or double quotes for string values?
If not what do most Clipper\HMG programmers use?