I am currently in my 3rd year of engineering in Information and Communication Technology from Pandit Deendayal Energy University. I aspire to be a good software developer.
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 am currently in my 3rd year of engineering in Information and Communication Technology from Pandit Deendayal Energy University. I aspire to be a good software developer.
Can you explain about iterative design pattern?
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
Thank you @may for this answer, very useful.