Back to list
Views:   16.8K
Replies:  2

Combination of Composite Pattern and Visitor Pattern


I'm new to C# design patterns and I've read your sample code of patterns Composite and Visitor.
Its very interessing but I think there is great benefit by combining Composite and Visitor Patterns.

Use Composite to build a tree, for example:
        <person name="pers1">
                        <child name="child1"/>
                         <child name="child2"/>
        <person name="pers2"/>
        <person name="pers3"/>

And use Visitor to visit each of the Tree nodes.

But my question is this: How can we build such a structure?

Gophisco Jazz, Jan 07, 2011
Reply 1
Yes, we can build this structure, see the attached code in zip file. To elucidate further read about pattern hatching by John Vlissides, which tells about patterns vs pattern languages and how we can combine 2 patterns to get maximum throughput. Please feel free to ask if you have any problem with code.
Narayanan Rajagopalan, May 15, 2011
Reply 2
Until someone someone answers this please go through this resource as it has some useful information.

I hope this will be useful for further exploration of the subject.
Rajesh Pillai, Jan 10, 2011
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.