At 5:30 PM +0100 10/12/00, kevin dowd wrote:
>Hello,
>
>Is having this kind of set up in your Object O.K.
>
>
>
>on settheProp me, theProp, theVal
>   me[theProp] = theVal
>end
>
>on broadcastProp me, theProp
>   return me[theProp]
>end
>


kevin,

While this certainly works, I wouldn't do that for one important 
reason.  A set of handlers like this assumes that you know the _name_ 
of a property within an object.  But you as the programmer should be 
able to change the name of a property within an object without 
affecting the rest of the system.  This is part of the wonderful 
concept of "encapsulation".

If you want to reach into an object and get and/or set a property by 
name, why not bypass the handler and do it directly (the following is 
strongly discouraged!):

     someObject.somePropertyName = someValue

and

     someValue = someObject.someProperty

Instead, I would only build accessor methods for the properties that 
you need to get/set and make the names of these handlers not match 
exactly the name of the property.

Irv


-- 
Lingo / Director / Shockwave development for all occasions.

        (Over two millions lines of Lingo code served!)

[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