Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set and Get appl obj property good practice
Message
From
31/07/2009 19:01:08
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
31/07/2009 17:32:48
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01415630
Message ID:
01415732
Views:
44
>>To differ from those code-heavy tools, in VFP you don't need to write the Get and Set methods (aka _access and _assign), because you can make any property directly available without writing a single byte of code. But you can, if you want. So, the best of both worlds - available and not mandatory.
>
>Is it really mandatory (from the technical perspective of "does not work if done against common usage") in Java now ?
>
>curious
>
>thomas

Not an expert in Java myself... From what I have seen so far, it should work if you access the properties ("fields" I think they are called in Java) directly (assuming you defined them with the appropriate access rights).

The problem here is that the designer of a class may later decide to change the internal data structures - and this may require to change any outside calls to this class. To avoid this, the data is encapsulated - the properties are hidden (from outside classes), and can only be accessed through "set" and "get" methods. Thus, the developer makes changes only within the class.

I don't know whether a newer version of Java allows something similar to the _access and _assign methods in Visual FoxPro. From what I have seen so far, it doesn't seem so.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform