DEV Community

loading...

Discussion on: Design Patterns for Web Development

Collapse
nirbhayparmar profile image
Nirbhay Parmar

Can you explain about iterative design pattern?

Collapse
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: refactoring.guru/design-patterns/i...
And also I recommend Christopher Okhravi's explanations since they are very good and complete: youtube.com/watch?v=uNTNEfwYXhI

Collapse
nirbhayparmar profile image
Nirbhay Parmar

Thank you @may for this answer, very useful.