Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • If a child object can't do anything useful without a parent, having a child object start without a parent will require it to have a SetParent method which will either need to support changing the parentage of an existing child (which may be hard to do and/or nonsensical) or will only be callable once. Modeling such situations as aggregates (as Mike Brown suggests) can be much better than having children start without parents. Commented Dec 4, 2014 at 4:30
  • If a use case calls for something even once, the design must allow for it always. Then, restricting that capability to special circumstances is easy. Adding such a capability afterwards however is usually impossible. The best solution is Option 3. Probably with a third, "Relationship" object between the parent and child such that [Parent] ---> [Relationship(Parent owns Child)] <--- [Child]. This also allows multiple [Relationship] instances such as [Child] ---> [Relationship(Child is owned by Parent)] <--- [Parent]. Commented Jan 8, 2016 at 9:02