Wednesday, December 9, 2015

Head First Design Pattern Ch9: Iterator Pattern & Composite Pattern

Iterator pattern is easy, you hide your internal implementation and provide a global way to iterate over elements:

Composite Pattern
Composite pattern is used when you want to have a tree representation,
for example the relation between employee is like a tree, a manager and employee

the implementation and usage is simple:

the usage is like this:

No comments:

Post a Comment