Hi all,
I am trying to get my head around this concept of cardinality, which on the face of it, seems quite intuitive.
Apple says:
In one of the tutorials on Cocoa for Scientists, the example uses a program to build an "application that allows you manage a personal database of molecules." The early object-graph developed looks like this.
http://images.macrumors.com/vb/images/attach/png.gif
Essentially, the Atom entity is related to the Element entity to-one, and the inverse is related to-many. Now intuitively, this makes sense. An atom can only be related to a single Element, but an Element could consist of any type of atom. But, when one boils it down, what **exactly** is being related? It would be correct, for example, to say that an instance of the Atom entity can only be related to a specific element entity, but the converse would also be true ie given a specific Element instance, one could only be related to a single atom instance. Clearly there is something more that I am missing.
Or...is it as simple as saying the analogy to the MVC would be something like this. In a to-one relationship, the ref in the Atom Class to the Element class would be an instance of the Element class, but in the Element class, the reference to the Atom class would be an **array** of Atom objects?
Anyway...if anyone has ever over thought this the way I usually do, and can clear my fuzzy thinking, that would be great.
Thanks in advance.
I am trying to get my head around this concept of cardinality, which on the face of it, seems quite intuitive.
Apple says:
Every relationship has a cardinality; the cardinality tells you how many destination objects can (potentially) resolve the relationship. If the destination object is a single object, then the relationship is called a to-one relationship. If there may be more than one object in the destination, then the relationship is called a to-many relationship.
In one of the tutorials on Cocoa for Scientists, the example uses a program to build an "application that allows you manage a personal database of molecules." The early object-graph developed looks like this.
http://images.macrumors.com/vb/images/attach/png.gif
Essentially, the Atom entity is related to the Element entity to-one, and the inverse is related to-many. Now intuitively, this makes sense. An atom can only be related to a single Element, but an Element could consist of any type of atom. But, when one boils it down, what **exactly** is being related? It would be correct, for example, to say that an instance of the Atom entity can only be related to a specific element entity, but the converse would also be true ie given a specific Element instance, one could only be related to a single atom instance. Clearly there is something more that I am missing.
Or...is it as simple as saying the analogy to the MVC would be something like this. In a to-one relationship, the ref in the Atom Class to the Element class would be an instance of the Element class, but in the Element class, the reference to the Atom class would be an **array** of Atom objects?
Anyway...if anyone has ever over thought this the way I usually do, and can clear my fuzzy thinking, that would be great.
Thanks in advance.