On Aug 10, 2006, at 4:15 AM, Andy Davies wrote:

"Code to interface not to implementation" also implies that it's
better to ask the object's method than to query the object's
properties.

If you consider a 'property' to be a wrapper round a set/get method isn't
this a distinction without a difference?

It actually depends on the interface you design. If you design an object to always have a certain property, then it is part of the interface, and you can count on it not changing. Since most VFP advice on this subject came about well before the addition of _access and _assign, there was a clear benefit to only making methods the public interface; hence the preference among Fox developers for this style. If you go into other languages, it can be very different. Java almost exclusively relies on getter/setter designs. Python has properties, which can be wrapped behind the scenes with get/set code, making it much like _access and _assign in VFP.

- and the fact that this sort of question is still regularly discussed here and elsewhere is one of the things that discourages me from going fully
oop.

It's really very simple: objects need to interact with each other to do anything useful. When you create the classes for these objects, define ahead of time how this communication is to take place. It really doesn't matter if it's through get/set methods, direct attributes, method calls, or whatever; as long as it's defined and can be counted on not to change, you're good to go.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com





_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to