Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Public Variable 3

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,826
JP
I see a lot of discussion and some very religious arguments about Public Variables, so I don't use them lightly, and when I find I'm about to I give it a lot of thought.
One instance in particular is, the status of showing tool tips. Some people like them, some people hate them, so I give the option to turn them on or off. This is done with a Public Variable called glTipState. It's a logical value, only .T. or .F.

So for the no public variable purist, what danger am I really facing here? And I'm also reminded that the machines we use today are massive boxes with memory bigger than hard drives were in the day VFP had it's last horizon even. So, why is this a problem? Or is it?


Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
The t is from the old Codebook naming conventions (a variant of "reverse Hungarian" naming conventions used in other languages):

[ul]
[li]g = global (public)[/li]
[li]p = private[/li]
[li]l = local[/li]
[li]t = parameTer[/li]
[/ul]

Private isn't used much since the advent of local.

Also note that your application object doesn't actually need to be a public variable. You can just as easily make it private. Since it's created in your top program it'll be visible throughout your application. I usually leave it public, though, so that it persists when you crash to the command window during testing.
 
Thanks Tore. I was familiar with l, p and g, have been using all those for years. Never encountered t before, so good to know.


Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
I use the naming conventions it all the time in my answers, including t. you have seen it for sure.

Bye, Olaf.
 
Olaf, yeah maybe. I'm dyslexic as well, so I may have interpreted t as l in the past without realizing it because "l" is what my head "expected" to see.

Best Regards,
Scott
MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top