Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Composite Design Pattern by: Dela Cruz, Evangelista,  Felisco, Jumawan REFERENCE:  http://www.javaworld.com/javaworld/jw-0...
Composite Objects <ul><li>Objects that contain other objects </li></ul><ul><li>It compose objects into tree structures to ...
Problems Resolved <ul><li>It lets clients treat individual objects and compositions of objects uniformly. </li></ul><ul><l...
Sample Code (Composite method) <ul><li>public void draw() { // Iterate over the components for(int i=0; i < getComponentCo...
Upcoming SlideShare
Loading in …5
×

Composite Design Pattern

1,092 views

Published on

Published in: Education, Technology, Business
  • Be the first to comment

  • Be the first to like this

Composite Design Pattern

  1. 1. Composite Design Pattern by: Dela Cruz, Evangelista, Felisco, Jumawan REFERENCE: http://www.javaworld.com/javaworld/jw-09-2002/jw-0913-designpatterns.html http://www.javaworld.com/javaworld/jw-09-2002/jw-0913-designpatterns.html
  2. 2. Composite Objects <ul><li>Objects that contain other objects </li></ul><ul><li>It compose objects into tree structures to represent part-whole hierarchies. </li></ul><ul><li>Example: </li></ul><ul><li>A drawing may be composed of graphic primitives, such as lines, circles, rectangles, text, and so on. </li></ul>
  3. 3. Problems Resolved <ul><li>It lets clients treat individual objects and compositions of objects uniformly. </li></ul><ul><li>We often must manipulate composites exactly the same way we manipulate primitive objects. </li></ul>
  4. 4. Sample Code (Composite method) <ul><li>public void draw() { // Iterate over the components for(int i=0; i < getComponentCount(); ++i) { // Obtain a reference to the component and invoke its draw method Component component = getComponent(i); component.draw(); } } </li></ul>

×