On Jun 20, 7:33 am, [EMAIL PROTECTED] (Rob Dixon) wrote:
> Well, sort of. Objects are simply intelligent data structures - structures 
> with
> code as well as data that know how to perform operations on themselves.

Not to put too fine a point on it, but early on when I was learning
OOP, I often read descriptions of objects that were similar to this
one, i.e., that objects "contained" code and could "perform operations
on themselves".

To my mind, this is a poor way to express things and, at least for me,
can lead to confusion.  After faltering with Java for a while, it was
not until I learned how Perl handles OOP that the whole zoo of
concepts finally sank into my (admittedly less than razor sharp)
brain. In my opinion, a better and more accurate way to express it
would be something like:

Objects are data structures that are associated with code designed to
perform operations on them.

I have never seen an object perform an operation on itself.  :-)  I
have seen many methods perform operations on objects.  I have seen
objects inform the system calling the method where that system may
find the proper code for that object.

So objects out in the wild are data structures that (usually) do not
have code "in" them.  They must be fed to a method of their class,
which is where the code is.  The objects DO have the information that
tells, say, Perl, in which class it should start looking for the
method.

Regards,

--
Brad


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to