Where does the time go?

Ned Konz ned at bike-nomad.com
Mon Jul 15 05:08:44 UTC 2002


On Sunday 14 July 2002 09:35 pm, Ross Boylan wrote:
> On Sun, Jul 14, 2002 at 08:36:38PM -0700, Ned Konz wrote:
> > Morphs already have their own #myEvents property.
> >
> > It's trivial to make them have their own #myDependents property:
> >
> > Morph>>myDependents
> > 	^self valueOfProperty: #myDependents
> >
> > Morph>>myDependents: deps
> > 	self setProperty: #myDependents toValue: deps
> >
> >
> > See if that doesn't help somewhat...
>
> I see the words, but I don't know the music.  What is this whole
> property scheme trying to accomplish?  And would using it have any
> advantages over, for example, defining an instance variable
> dependents and doing the accessors as in Model?

The property scheme is a way to make the "instance variables" more 
dynamic in Morphs.

So we can add what would otherwise require changing the shape of Morph 
(which would break projects, etc.) without needing to be so drastic.

[Remember, Morphic came from a more dynamic language (Self). In Self, 
you can define new "slots" on a per-instance basis. None of these 
pesky classes to give you problems.]

Anyway, if you have control over the Morph class in question (i.e. 
it's one you wrote), then it would be faster and would require 
somewhat less memory to provide an instance variable.

If, on the other hand, you want to change the behavior of all Morphs, 
it's better to use a property and edit these two methods.

I used properties heavily in Connectors to extend the behavior of 
Morphs without changing their shape or modifying base Morph behavior.

You might also try:
Object reInitializeDependentsFields

and see if your system gets any faster.
-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list