> 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 was sort of uncertain on this point as well, and settled on solution which 
is a combination of accessing a particular object property and creating x
unique, although nearly identical, handlers. 

I use accessor handlers which a pseudeo property name as input. A case structure 
determines what object property is associated with the pseudo property and 
returns (or sets) the given property value. Should the need ever arise to 
change an object's property names, it can be done without hunting down all 
of the calls to the accessor handlers.


on mGetProp me, whatProp
  -->returns a property value
  
  case whatProp of 
      
    #pIsFinished: myReturnVal = pIsFinished
      
    #pAnswer:     myReturnVal = pAnswer
      
    otherwise: alert ("property not found: oMC_top.mGetProp: "&& whatProp)
      
  end case
  
  return myReturnVal
  
end

my .02
Chris

[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