Object Relationships
This page covers Object Relationships, one of the Advanced Concepts that are useful for anyone using Glencoco's platform, general CRMs, or are otherwise data-oriented.
In object-oriented programming, structured databases, and CRMs, Object Relationships are an important concept.
Definition(s)
Object Relationships allow Objects instances to be related to other Objects instances.
Object Relationships come in 3 forms:
One-to-One: there can only be one possible linkage between an object instance and another object instance for this type of relationship.
One-to-Many: there can only be one object instance for one end of the relationship, but that one object instance can be related to many instances of other objects for this type of relationship.
Many-to-Many: there can many object instances can be related to many object instances for this type of relationship.
Object IDs are important and must be used to manage Object Relationships.
Abstract Examples of One-to-One Relationships
Person <> Primary Passport (there can only be one primary passport per person).
Company <> BIlling Address (there can only be one official billing address for a company)
Abstract Examples of One-to-Many Relationships
Company <> Full-Time Employees (there can be many full-time employees at a company, but an employee can only be a full-time employee at one company)
Customer <> Orders (there can be many orders placed by a customer, but multiple Customers cannot be associated with a given order)
Abstract Examples of Many-to-Many Relationships
Students <> Classes (there are many students enrolled in a class, and those same students can be enrolled in multiple other classes.)
Linking Objects for One-to-One or One-to-Many Relationships
Typically, for simple one-to-one or one-to-many relationships, one of the Objects will have as one of their Object Attributes as column/field called 'Other_Object_ID'.
For example, suppose every person has a one-to-many relationship called 'Biological Father'.
Then the person schema could look like:
Person (object)
Schema ( Object Attributes)
Birthday
Social Security Number (their unique Object ID)
Legal First Name
Legal Last Name
Email Address
Phone Number
Biological Father's Social Security Number ( Object Relationships)
Since Biological Father's Social Security Number can only have one social security number, but multiple people can have the same value for their Biological Father's Social Security Number.
Linking Objects for Many-to-Many Relationships
Linking different objects for many-to-many relationships is not as straightforward.
Consider the Students <> Classes many-to-many relationship.
You could have the same student appear multiple times in the students table, with a different class ID for the same student, but the whole point of breaking out different Objects is so that each object has a clean, unique list of its object instances.
Instead, a 'junction object', aka 'relationship table' needs to be used. This is a separate object, or table, that might only store two Object Attributes: Object_ID, and Related_Other_Object_ID.:
Student Object Instances
Student Class Relationship Instances
Class Object Instances
5.112
Biology
14.41
Game Theory
6.046
Algorithms
Junction objects, or 'relationship tables', can also be used for one-to-one and one-to-many relationships.
Last updated
Was this helpful?