From: Sammy Larbi Date: 2006-10-26T23:24:48+09:00 Subject: Re: Beginner would like help with oo-modelling Pa Per wrote: > Sammy, > what do you mean by 'sticking to the metaphor' ? Haven't heard that > expression before, I'm not a native speaker. > Well, when you are building a system, essentially you are modeling some domain. So, take for instance, we want to model a person. So we might have as attributes of a person: Name Hair color Hair length Eye Color ... DNA sequence (this would likely be unique) To me, it would make more sense to have DNA as an attribute inside the person object, not as a reference in a hash. The way I understood your description of using the hash, it would be something like this: ["DNA sequence 3232" => person_object_1, "DNA sequence 3999" => person_object_2 ... "DNA sequence 9882" => person_object_n] and each person object would have Name, Hair color, Hair length, Eye color ... as attributes (not including the DNA sequence). So, you'd "know" a person's DNA sequence by getting the keys and seeing which person object each key referred to. To me, it would make sense to store this information in the object. Now, if you needed quick access to search for a person based on their DNA, you might ALSO store it in a hash as well, using the DNA as a key. But if you were just going to iterate through them, an array would do just fine. Basically, I got the idea that you weren't storing a property that belongs to a line (its position) within the line, and if you follow the "metaphor" a line should have a position, among other attributes. -Sam