Naming Conventions

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

melliott42
Posts: 119
Joined: Wed Feb 18, 2009 2:14 pm

Naming Conventions

Post 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
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Naming Conventions

Post 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
Viva INTERNATIONAL HMG :D
melliott42
Posts: 119
Joined: Wed Feb 18, 2009 2:14 pm

Re: Naming Conventions

Post 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.
melliott42
Posts: 119
Joined: Wed Feb 18, 2009 2:14 pm

Re: Naming Conventions

Post by melliott42 »

Is it true that all Clipper\HMG variables for arrays are PUBLIC variables?
melliott42
Posts: 119
Joined: Wed Feb 18, 2009 2:14 pm

Re: Naming Conventions

Post by melliott42 »

Another type too is distinguishing a FUNCTION parameter.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Naming Conventions

Post 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
Last edited by esgici on Wed Mar 20, 2013 9:44 pm, edited 1 time in total.
Viva INTERNATIONAL HMG :D
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Naming Conventions

Post 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
Viva INTERNATIONAL HMG :D
melliott42
Posts: 119
Joined: Wed Feb 18, 2009 2:14 pm

Re: Naming Conventions

Post by melliott42 »

Here is a nice take on HMG related naming conventions too:

http://members.casema.nl/r.vd.boom/CodStdCl.htm
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Naming Conventions

Post by esgici »

Good source, thanks Michael :)

Regards

--

Esgici
Last edited by esgici on Wed Mar 20, 2013 9:44 pm, edited 1 time in total.
Viva INTERNATIONAL HMG :D
melliott42
Posts: 119
Joined: Wed Feb 18, 2009 2:14 pm

Re: Naming Conventions

Post 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?
Post Reply