Maybe not blog and blog collections as such, but I have definitely seen situations where a Post has Text and Comments, but Comments also have Text and Comments.
Reddit for example.
Both Post and Comments would composite objects in this regard however.
The Text would need to be an object of its own, with no children to fit this pattern.
But the Text may have other data it holds such as likes, reactions etc.
If we ask a Post how many reactions it contains, it can ask it's Text object for its number of reactions, then ask it's comments for its number of reactions, which will iterate through each top level comment, ask it's Text for number of reaction, then it'll ask it's own children for their number of reactions, fulfilling the recursive tree structure of the pattern.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Maybe not blog and blog collections as such, but I have definitely seen situations where a Post has Text and Comments, but Comments also have Text and Comments.
Reddit for example.
Both Post and Comments would composite objects in this regard however.
The Text would need to be an object of its own, with no children to fit this pattern.
But the Text may have other data it holds such as likes, reactions etc.
If we ask a Post how many reactions it contains, it can ask it's Text object for its number of reactions, then ask it's comments for its number of reactions, which will iterate through each top level comment, ask it's Text for number of reaction, then it'll ask it's own children for their number of reactions, fulfilling the recursive tree structure of the pattern.