DEV Community

Discussion on: Design Patterns for Web Development

mayruiz27 profile image
May Author

Hi Nirbhay! The iterative pattern lets you traverse a collection of items without specifically exposing how this collection is structured. Imagine this collection being a tree that you could traverse either using a depth-first or breadth-first approach. The "getNext()" function iterator will work differently depending on the approach. This is not exposed, so the objects calling the iterator just care about getting the next element but they don't know which structure is used or how it is traversed.

I hope I can work on other design patterns next, but for now, you can check this resource:
And also I recommend Christopher Okhravi's explanations since they are very good and complete:

nirbhayparmar profile image
Nirbhay Parmar

Thank you @may for this answer, very useful.