Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set and Get appl obj property good practice
Message
 
 
To
31/07/2009 09:22:30
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01415630
Message ID:
01415640
Views:
54
>
>I suggest using an array (or a collection) for properties related among themselves. For example, an array with references to all open forms. If you have unrelated properties, it is convenient to be able to access by name.
>
>As to get and set methods... I understand that in Java, for example, this is the recommended practice, to encapsulate (hide from other parts of the program) details about the internal workings of the class. However, in Visual FoxPro 6 and later there is another way to do this - access and assign methods. In other words, you may decide to store a value in an object property, which has a certain name, type, and data structure. But if you later decide to change the internal workings of the object, you can intercept calls to the object, from outside, with access and assign methods - and store the information in a completely different way - without having to change programs that call it.
>
>Now, I don't know whether this is a "recommended practice", but it does give you an alternative.

Thank you, Hilmar. Very helpful input. Especially about Access and Assign methods. Although, in this case - what seems to be pretty straight forward - I was thinking about getting the value of the array (or collection) property directly from the application object. For example:
cMyTableName = oApp.aMetaTableName[2]
Of course the array element number can be used as a name in .H file.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform