
Software Design – The Iterator Pattern
At long last, we come to my number one pattern. The iterator is one of those software concepts that you come across and do not know how you managed before you learned it. Maybe it is just my frequent need to work through a collection of objects, but I think this is one of the most fundamental behavioral patterns you can master. The Iterator Pattern Defined As always, we will start with the “Gang of Four” intent to set the stage for our discussion. “Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.” Yes, this is the “while” syntax of software patterns. The goal is to walk through a collection without regard to the underlying... Read more