Understanding the Composite Pattern
page 6 of 9
by David Simmonds
Feedback
Average Rating: 
Views (Total / Last 10 Days): 35991/ 94

Advanced Issues

Useful variations

1a        Chameleon-Composite

Composites allow components to switch between composites and leaves.

1b        Classic-Composite

Components end their life the way they started. Leaves continue to be leaves throughout, while composites continue to be composites throughout.

2a        Leafy-Composite

Every component is a leaf and will perform the primitive, low-level operations on it in addition to forwarding messages to its children to perform similar operations

2b        Leaf-on-Branch Composite

Composites do not have primitive functions and simply forward processing instructions to their child components (typical case).

3a        Electoral-College-Composite

Some composites behave as leaves at the level above it and composites to the level below it as in the election vote-counting system. This may seem obvious and readers may think it is the typical case, but what we are saying is that in this scheme, the highest levels of composites are affected empirically by the lowest level leaves. Another good example of this is in the electoral-college system of voting, where you can lose the popular vote but still become president.

3b        Popular-Vote-Composite

Every single leaf and mid-level composite filters up to the highest level and is counted there.

4a        Birth-Cert composite

Leaves know who their parents are and can reference their parent in performing their operations. One could argue that you could achieve the same results by passing a “my-parent” token to the children as you traverse them, but how do you access the grand-parent when you need to?

4b        Foster-Child Composite


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-12-05 12:13:41 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search