Slide 1
Breaking news…..
Menu Implementations - Pancake House
Dinner Menu Implementations
Slide 5
Implementing the Waitress
What now?
What now?
Simple Iterator
Meet the Iterator Pattern
Using the Iterator for the Diner Menu
Reworking the Diner Menu with Iterator
Fixing up the Waitress Code
What have we done?
Bird’s Eye View of Current Design
The Iterator Pattern Defined
Design Principle: Single Responsibility
Brain Power
The java.util.Iterator
Using java.util.Iterator
DinerMenuIterator implement java.util.Iterator
Iterator in Java 5
Is the Waitress ready for prime time?
Packaging into an ArrayList
Composite Pattern
Just when we thought it was safe …
The Desired Menu Structure
So what do we need?
Possibilities
The Composite Pattern Defined
Composite Pattern Structure
Designing Menus with Composite
Implementing the Menu Component
Implementing the MenuItem
Implementing the Menu Composite
Implementing the Menu Composite
An Observation - Violating SRP?
Flashback to the Iterator – A Composite Iterator
The Composite Iterator - A Serious Iterator
The Composite Iterator (con't)
The Null Iterator
Give me the vegetarian menu…
Exceptions and Program Logic….
Other Composite Pattern Examples
File System
Graphic hierarchy
List Structure
Binary Tree
Arithmetic Expression hierarchy
Summary (1/2)
Summary (2/2)