Properties: - Used when it is necessary to execute actions on members of an object structure (e.g. collections, hierarchical structures, composite structures). - Separates algorithm of the actions from the object structure members. So that new algorithms can be modified easily. - This pattern relies on polymorphic calls and helps to follow open/closed principle . - Another advantage is that visitor objects may be statefull. - One disadvantages is, while it is easy to add new visitors, it is difficult to add new observable objects. Implementation: - Visitor interface declares visit methods. For...
Software Engineering experiences and best practices