Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global mem vars -> global application properties?
Message
From
10/07/2001 22:05:04
 
 
To
10/07/2001 21:57:24
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00528711
Message ID:
00529018
Views:
15
Cindy-

>To go a little further with what Nancy said, any variable initialized in the Main program is seen throughout the application by default, and it need not be specified as "global."

That's an aside. But, yes, it's correct. That's because it (an otherwise undeclared variable) is a private and visible to all child procedures, which is everything from the MAIN.PRG and down. I dislike globals (except for an app object), but if one is going to use them in concept, I like it when a program declares them so. It helps make intent explicit. And, of course, one might use GLOBAL to keep the functionality in the case of an architecture change.

>Some developers use an Application Object (oApp) which holds all the "variables" as properties. You could initialize the oApp in the Main program and when the user identifies himself, pick up the properties and assign them to oApp.

A much better approach to globals, of course, in that it consolidates the global variables in one object. I hope that Claude considers it. I read his post to say he wanted to keep his globals but set them from a table instead of, on assumes, programmatically hardcoded.
Previous
Reply
Map
View

Click here to load this message in the networking platform