Iterator Pattern Baljeet Sandhu 20060621

1,176 views

Published on

Published in: Economy & Finance, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,176
On SlideShare
0
From Embeds
0
Number of Embeds
25
Actions
Shares
0
Downloads
25
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Iterator Pattern Baljeet Sandhu 20060621

  1. 1. Iterator Pattern Presented by Baljeet Sandhu - 21 st June 06 Based on Head First Design Patterns by Elisabeth Freeman, Eric Freeman, Bert Bates, Kathy Sierra
  2. 2. <ul><li>Ace Group </li></ul><ul><ul><li>Suburban hardware reseller </li></ul></ul><ul><li>Two Divisions </li></ul><ul><ul><li>Desktop division </li></ul></ul><ul><ul><li>Laptop Division </li></ul></ul><ul><ul><li>Each group manages its own inventory </li></ul></ul><ul><li>Provide integrated view of inventory </li></ul>Scenario
  3. 3. Inventory Item - Common to both divisions
  4. 4. Desktop division – Inventory Manager
  5. 5. Laptop division – Inventory manager
  6. 6. Inventory Printer
  7. 7. Encapsulate iteration
  8. 8. Implement Iterator for Laptop Division
  9. 9. The new design..
  10. 10. InventoryPrinter revised
  11. 11. What did we improve.. <ul><li>Do not need to know the implementation </li></ul><ul><li>Class does not have to manage iteration </li></ul>Use an interface, uniform way of accessing collections
  12. 12. Iterator pattern Provides a way to access the elements of an aggregate object without exposing its underlying representation

×