OOPS

Object Relations

eyJjb2RlIjoiZmxvd2NoYXJ0IExSO1xuT2JqZWN0IC0tPiBSZWxhdGlvbnM7XG5PYmplY3QgLS0-IENoYXJhY3RlcnN0aWNzO1xuUmVsYXRpb25zIC0tPnxcIm5vIGxpZmUgYXNzb2NpYXRpb25cInwgQWdncmVnYXRpb247XG5SZWxhdGlvbnMgLS0-fGhhcyBhfCBDb21wb3NpdGlvbjt

Handling object relationships within code:

Relation Handling
Aggregation References
Composition References
Generalization Abstraction
Realization Interface

Relations may also be:

Bank and Customers are a good example of one-to-many relationship.

S.O.L.I.D. Principles

https://www.digitalocean.com/community/conceptual_articles/s-o-l-i-d-the-first-five-principles-of-object-oriented-design

Example: School & Department

Tightly-Coupled & One-To-One. Both objects have strong dependency on one another.

class School {
  private Department d;

  School() {
    d = new Department(this);
  }

  // Public getter.
  public Department getDepartment() {
    return d;
  }
}

class Department {
  // Keeps reference to that particular School instance.
  private School s;

  // Take reference.
  Department(School school) {
    s = school;
  }

  // Public getter.
  public School getSchool() {
    return s;
  }
}