On Fri, Sep 11, 2009 at 1:30 PM, Joel VanderWerf <vjoel / path.berkeley.edu> wrote: > Pascal J. Bourguignon wrote: >> >> Actually, the analogy that is often taught is that of "naming". > > I've never liked that analogy much. It leads to the question "If I have an > object, how do I get its name?". This is nonsense, unless the object has a > name attribute or (as with ruby classes) you are prepared to search for a > constant that refers to the object. This objection seems to presuppose that each object has (or should have) one and only one name. Why? http://www.youtube.com/watch?v=qoYsfbq3vMc In general names are not actually atributes of any real world object. The fact that ruby Classes know 0-1 name is an anomaly, and really can't be generalized. An object can have multiple names. I'm Rick, Richard, RubyRedRick, ... Some people have pet names for their spouses, sometimes known only by the two. Sometimes a "sentient" object knows some of it's names, sometimes it doesn't. That cute little redhead in my High School algebra never knew that I called her "that cute little redhead." And I'm sure that my car doesn't know that I call it Franz. I'm sure that people refer to me by some names of which I'm unaware, probably some of which I wouldn't wish to be aware of. And the connection between a name and an object can be temporary or transitory, What I call my home is a different object now than it was 10 years ago, and still a different object 30 years ago. No I think naming is quite a good analogy to the relationship between variables and objects in Ruby. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale