Ryan Dunphy
Ryan Dunphy

Reputation: 848

Term to represent a parent that has children that no longer exist

I'm looking for useful terminology to represent case(es) where a parent is no longer able to access a child. Let's say I have an object that at one point contained an array of child elements

    {
      id: 123,
      childIds: [1,2,3]
    }

Then, through whatever circumstances, the child Id 2 that this object referenced was destroyed. In this case, id: 123 will no longer be able to retrieve id 2 because it simply no longer exists.

When a child loses its parent, it becomes an orphan. Digging around, I see that there doesn't seem to be an effective term for a parent that loses their child.

I like the explanation on this one:

However, for the moment I'm settling on bereaved/bereft as "orphaner" just doesn't roll off the tongue. I'd much rather call getBereft() than getParentsThatLostTheirChildren()

In the meantime, I'll continue wondering if there is a more appropriate computer science-ey term out there that my fellow programmers might be using.

Upvotes: 1

Views: 62

Answers (1)

RobertBaron
RobertBaron

Reputation: 2854

The terms Parent and Child only make sense when used in a relative manner, and are typically used to qualify relationships to other objects, such as Nodes in a tree. There are many commonly used terms to qualify relationships between nodes and properties of nodes in a tree. You have already mentioned, Parent, Child, Orphan. There are also:

  • Ancestor, relation of a node to all of its ancestor nodes.
  • Descendant or Offspring, relation of a node to all of its descendant nodes.
  • Sibling, relation between nodes that have a common parent node.
  • Leaf, a node that has no child.
  • Root, a node with no parent.

And there are probably several others.

When writing get/set/is functions, these qualifiers are typically not use alone, but concatenated with the term Node, such as GetAncestorNodes(), GetSiblingNodes(), GetLeafNodes(), IsLeafNode(), etc. This is for maximum clarity, but when the context is clear, we often see GetChildren(), GetDescendants(), GetLeaves(), etc.

Upvotes: 1

Related Questions