Search the Community
Showing results for tags 'composition'.
-
Hi all, first post here, hopefully it's the right place. I posted over on the dark side in the AF forum but was lead into the direction of the composite pattern rather than to use the AF for this portion of my application. The reasoning seems sound, so I didn't want to continue my post in the AF forum and it seems like there's a little more OO talk over here than there. So I read the wiki (http://en.wikipedia.org/wiki/Composite_pattern), and looked at the Graphics example in the OO shipping examples in LabVIEW, as well as the OODesign.com page for it (http://www.oodesign.com/composite-pattern.html) but I'm still a little lost on how to implement it in my application. I'm trying to create a sequence engine, the basic system looks like this; Protocol - the definition of the "sequence". Group - The highest level of heirarchy, contains an array of children called "Step". This iterates between one and N times. Every time a group iterates it increments a variable used in another part of the application. Step - Next level down, has an array of children called "Functions". A step can have anywhere from one to N repetitions, essentially a For loop of "Functions" Function - Next level down, contains an array of "Actions" Action - The base component. This is what actually executes. The composite pattern says that there's an interface object and than a leaf object and a composition object which both inherit from the interface. The leaf is where the action happens, the "Execute" as it were. So I think my Action class is a leaf. But if so than the Function, Step, Group, and Protocol, are all variations on a composition and that seems to not make sense to me. I feel like I'm not looking at this the right way, or if I am, than there's some piece of the puzzle that I'm missing to make this all fall into place in my head. Any help would be appreciated to try and point me in the right direction.