dblack / candle.superlink.net wrote:

> Doesn't that mean that you always have to know whether something was
> defined with attr_reader?  That seems like a kind of arbitrary thing
> -- it could always be redefined.  Also, what if you're using a library
> package?

Hi David,

I think you have a very good point here.

In my case, in some sense I develop the object model hierarchy from
scratch, so I do know all the properties of the simulation objects.  For
other people, in my manual for each class I distinguish between
"attributes" and "methods".  Attributes are things that are implemented
using the "@var".  This is done so that people who want to inherit from
a class can access the "@var" directly and do not have to use
"self.var".  Well, now people who know OO well may tell me whether it is
better for a derived class to access the "@var" directly or instead to use
"self.var".

If I'm using a library package, on the other hand, then it will be really
subjective.  For example, I may write array.length but array.sort().  It
is just a personal habit to treat "length" as if it is some data stored in
memory but "sort" as resulting in some processing.  Well, as already
pointed out by someone else, Meyer's uniform access principle says that we
don't need to know how "length" is really implemented; so this is really
just a personal style.

Regards,

Bill