Moving objects...
Josh Flowers
josh at i33.com
Fri Jul 23 17:55:17 UTC 1999
> I find it much more productive to think about methods as adding
> *behavior* to an object rather than as ways to push bits of the object
> around. Whether a particular method actually modifies the object or not
> is immaterial. As you add/refine methods you are adding/refining the
> object's behavior. This way you can more clearly separate simply
_using_
> an object's behavior from _changing_ or _extending_ an object's
> behavior.
>
I agree, that's how I've always thought of it too, but what I'm
wondering is if maybe we haven't gone off the deep end by doing that.
Should a string really have "behavior", or in the end does that
make our lives more difficult. Animate objects are much more
difficult to deal with than inanimate ones.
<< and from a different response >>
> Well, you are probably right about algorithms being attached to
objects...
>
> ....but that is likely so because that is where they most frequently
> occur or are most closely associated in the "eyes of the beholder"
> (programmer).
>
Again, I agree, placing these algorithms with the classes makes it
easier to find and use them, but is that possibly a short term gain
with a long term expense? There are certainly other ways for us to
organize our code, that do not involve including behavior with every
object.
What might be needed is a system that separates behavior methods
from state methods. That way objects could be passed easily between
modules (actually probably not modules the way we think of them now,
but something similar) by allowing the modules to define an objects
behavior methods, but having the state methods travel with an object.
Assuming that state methods are not nearly as prone to change as
behavioral ones (and that is truly an assumption, I don't have any
facts, or 20 years of experience to back it up), you would have a
more stable system than if you include both state and behavior in an
object.
Since I'm now beginning to travel into realms I haven't spent enough
time contemplating, I'll quiet down and try and think for a while.
More information about the Squeak-dev
mailing list
|