How can I describe a relationship between an object of which another object is a property?

Discussion in 'iOS Programming' started by moonman239, Jun 18, 2015.

  1. moonman239, Jun 18, 2015
    Last edited: Jun 18, 2015

    moonman239 macrumors 68000

    Mar 27, 2009
    In the English language, when we want to convey the idea that John is Jane's son, we might say "John is Jane's son". Or, we might say "Jane is John's mother." What we convey directly is how Jane is related to John.

    Suppose object A has a property, which is Object B. How can we describe this relationship? Obviously, we can say "object B is a property of object A." Or we could say "Object A has one property, which is Object B." But how can we describe this relationship in a way that resembles the second description of Jane (that she is John's mother)? A few possibilities come to mind: we could call A B's container, or maybe its owner. What other possibilities are there?
  2. waterskier2007 macrumors 68000


    Jun 19, 2007
    Novi, MI
    I may just be totally screwing this up, but I think you can use a weak reference to avoid a retain cycle, so if A is the parent with one->many children, you would have a strong array property that contains the children. You could then have a weak property on the children that points to their 'parent'. This way, if the parent is deallocated, the child is not still hanging on to that reference.

    I just got sad thinking about a parent dying or something :(
  3. mds1256 macrumors regular

    Apr 9, 2011
  4. *SteveB* macrumors newbie

    Jan 22, 2015
    I would be inclined to say that if object A had property object B, then A 'holds a reference' to B.

    A 'owns' B is usually, but not always accurate (at least, according the terminology I would usually use). I usually think that if one object owns another, then it has a strong reference to that object. A can't really own B if B will still exist after A has been destroyed.
  5. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
  6. moonman239 thread starter macrumors 68000

    Mar 27, 2009

Share This Page

5 June 18, 2015