1 / 11

Composite Design Pattern By Aravind Reddy Patlola.

Composite Design Pattern By Aravind Reddy Patlola. Composite Design Pattern. What is it? Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. Participants.

orea
Download Presentation

Composite Design Pattern By Aravind Reddy Patlola.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Composite Design Pattern By Aravind Reddy Patlola.

  2. Composite Design Pattern What is it? Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.

  3. Participants Component – An abstract base class that declares the interface for objects in the composition. Client – Manipulates objects in the composition thru component interface Leaf – A subclass that defines behavior of primitive objects in the composition Composite – A subclass that defines behavior for components having children.

  4. Structural Representation of a Participants

  5. Example

  6. General Structure of Composite

  7. Node Structure

  8. Object Structure

  9. When to use Composite? When you want to represent part-whole hierarchies of objects. When you want client to ignore the difference between compositions of objects and primitive objects

  10. Advantages Makes the client simple, by treating primitive and composite objects uniformly. Makes it easier to add components. Disadvantages Makes design overly general i.e., components of a composite cannot be restricted.

  11. References: • http://www.research.ibm.com/designpatterns/pubs/jr-jun01.pdf • Design Patterns – Elements of Reusable Object Oriented • Software by Erich Gamma, Richard Helm, Ralph Johnson, • John Vlissides. • http://collaboration.csc.ncsu.edu/csc326_oldSE_a/Topics/patterns • composite/composite.PDF

More Related