10 September 2019

Visitor Pattern

Two simple examples are taken from github repo about Visitor pattern:

The Visitor drops by:

  • The Visitor must visit each element of the Composite; that functionality is in a Traverser object.
  • The Visitor is guided by the Traverser to gather state from all of the objects in the Composite.
  • Once the state has been gathered, the Client can have the Visitor perform various operations on the state.
  • When new functionality is required, only the Visitor must be enhanced.

From: Head First Design Patterns.

1. https://github.com/devwebcl/simple_design_patterns/tree/master/visitor-pattern/src/main/java/com/iluwatar/visitor

2.  https://github.com/devwebcl/simple_design_patterns/tree/master/visitor-pattern/src/main/java/com/behavioural/visitor


  1. https://github.com/chirey/designPatternsThoughtsCode
  2. https://github.com/iluwatar/java-design-patterns/tree/master/visitor

No comments :

My Blog List

Blog Archive


The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.