Behavioral patterns
Iterator
Walks through a collection without exposing how it is stored.
Article
Iterator: walking a collection without looking inside
The Iterator pattern through orders from a delivery app fetched page by page: the loop in the report knows nothing about pagination, and pages load lazily, only when needed. Generators, yield and iter.Seq in five languages.
Related articles
- Composite – trees in which a leaf and a branch look the same
Composite lets you treat a single object and a whole group of objects in exactly the same way. A course curriculum example with modules and lessons in C#, TypeScript, Java, Go and Python.
Challenges
Around the topic
- Iterator / Iterator article · web · Refactoring.Guru
- Design Patterns – Iterators, Observers, and Chains, Oh My podcast · apple-podcasts · Coding Blocks
- Head First design patterns book · openlibrary · Eric Freeman, Elisabeth Freeman, Kathy Sierra, Bert Bates
- Collection Pipeline article · web · Martin Fowler
- Iterator article · web · Refactoring.Guru