> If my behavior has, say, 5 properties I want to access, I'd be tempted
> to write an all-round handler like:
>
> on getProperty me, prop
>   return value(prop)
> end
>
> which could be accessed with:
>
> theValueI_need = sendSprite(whateverSprite, #getProperty,
> "propertyName")
>
> However, this would seem to be a rash and dangerous balance
> on the edge
> of broken encapsulation. 'Cuz, I need to know the property
> name. It just
> seems to me that if I know the handler name, then I'm not ridiculously
> far from knowing the property name.
>
> The alternative would be to write 5 almost identical handlers that
> specifically return property values.
>
> Is that pure OOP?

I sure hope so, because I had a similar handler, not only accessing but
changing properties this way.
At the time, I posted this question to the list, and the reply seemed to be
that yes, it's pure OOP because it's the properties are still "owned" by the
object. It's the object's method that returns (or sets) the properties, and
not some arbitary method from another script.

On the other hand, it might be better from the "purist" point of vew to have
the 5 identical handlers, because then if you decide to change the name of a
property in an object, at some later time, you don't have to go and search
for all the scripts that refer to the property name.
Remember, that you can have different parent scripts have the same property
name, without conflicting with eachother. So if you want to change the name
of a property in just one of them, you can't always just go and "replace
all".

In the end, it's up to yourself.


Regards,
Karina Steffens,
Lead Programmer

Martello Media Ltd.
4 Islington Avenue
Sandycove
Co. Dublin

Tel: +353 1 2844668
Fax: +353 1 2803195
http://www.martellomm.ie






[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to