Nested collection pattern

P

peter.moss

Need some help!

I have a nested collection like so:
Grandparent
.Parent
.Child

Which is going to be bound to a datagrid in a flat view:
Grandparent1 | Parent1 | Child1
Grandparent1 | Parent1 | Child2
Grandparent1 | Parent2 | Child3
Grandparent1 | Parent2 | Child4
Grandparent2 | Parent3 | Child5
Grandparent2 | Parent4 | Child6

I was going to make a facade collection which takes grandparent
collection and generates a set of flat objects. These objects would
expose properties which would pass values to the appropriate wrapped
object (GrandParentName = GrandParent.Name, ParentName = Parent.Name
etc.). The facade/manager would have Add(), Remove() methods with
behaviour to ensure the integrity of the underlying collection.

Does this make sense or does anyone else have a better pattern? How
does one handle the persistance of the object (ActiveRecord type
thing)?

Advice welcomed very much!
 
P

peter.moss

Guys the Mediator pattern?

Here's an extension of it (the relationship pattern):
http://www.atug.com/andypatterns/RM.htm

I feel slightly annoyed as I had just come up with this pattern on my
own - believing I'd invented something new. I thought, to save myself
the embarasment I'd Google first and somebody has already solved it :(
 
Top