Correct Syntax???!!!

simplsol at aol.com simplsol at aol.com
Sat Mar 25 11:19:15 EST 2006


Dave Burgun wrote:
 [snip]
  I don't see how my way of doing things is in anyway not a standard 
xTalk approach. What we are talking about it the basic Object-Oriented 
programming. The concept of keeping all the house keeping of an object 
in that object and not spread across many different layers
 [snip]

  Actually the way you do it ignores one of the most powerful aspects of 
OOP in xTalks, "inheritance".

  If a unique object has a unique handler there is no harm in putting 
the handler in that object. But if the same code is being used by 
multiple objects it helps in many ways to centralize it:
 1. it is easier to update
 2. it is easier to debug
 3. it is easier to maintain
  4. it is more reliable (it works for all objects or no objects - not 
just some objects)
 5. you won't accidentally forget it on a new object
 6. etc.

  One of the problems in xTalk scripting is that handlers can be spread 
across multiple objects anywhere in the message path. Makes it hard to 
debug some else's code - or even code I wrote myself last year. Using 
central library scripts help solve this.

  Your concern about looping through all of the objects on a card (or 
even all of the cards in a stack) does not, in my experience, outweigh 
the benefits of the central library. Modern computers with RISC chips 
are optimized for repeat loops, they do massive repeats in milliseconds 
(I can update all of the 300+ fields on a card in 82 milliseconds - and 
today's computers are twice as fast as mine).

  You are certainly free to use what works best for you or what you are 
most comfortable using but I think Jacque offered excellent advice. I'd 
like to see this as a "style" section in future documentation. I wish I 
had started using this approach instead of "learning the hard way".

  Paul Looney



More information about the use-livecode mailing list