Iterator, Visitor, Observer, and Memento

When your task is writing code that is simple to maintain and test, you strive away from tightly connected parts that know too much about each other. The four patterns that will be described in this chapter will help you write complex code that interacts in different ways but is not interconnected in all possible—and impossible—ways in an unmanageable mess.

Two patterns from this chapter, iterator and observer, are, in my opinion, the two most important patterns from the Gang of Four collection. If you incorporate only two patterns into your code, let them be these two! They both help with decoupling parts of code and programming to the interface, not the implementation; two guidelines that will help ...

Get Hands-On Design Patterns with Delphi now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.