ConcreteVisitor

E679881

ConcreteVisitor is a specific implementation of the Visitor pattern that defines the actual operations to be performed on elements of an object structure.

Jump to: Statements Referenced by

Statements (48)

Predicate Object
instanceOf Visitor pattern participant
design pattern component
belongsToPattern Visitor pattern NERFINISHED
canBe stateful
stateless
canBeExtendedBy subclasses adding more specialized behavior
collaboratesWith ConcreteElement
Element
ObjectStructure
commonIn UML examples of Visitor pattern
definedBy Gamma et al. (Gang of Four) Visitor pattern description NERFINISHED
defines concrete operations for each element type
dependsOn stable element hierarchy
documentedIn Design Patterns: Elements of Reusable Object-Oriented Software NERFINISHED
enables adding new operations without modifying element classes
exampleLanguage C#
C++ NERFINISHED
Java NERFINISHED
Python NERFINISHED
hasMethod visit operations for each concrete element subtype
visitConcreteElementA
visitConcreteElementB
implements Visitor interface
visit operations for each ConcreteElement
invokedBy Element.accept method
mayContain accumulated results of visiting elements
context needed for visit operations
oftenUsedFor operations that depend on concrete element types
traversal-related computations
type-specific processing of object structures
operatesOn elements of an object structure
patternCategory behavioral pattern
primaryGoal localize operations that apply across a set of element classes
relatedConcept Element.accept(Visitor v)
double dispatch via visit and accept methods
requires a Visitor interface or abstract class
concrete element classes exposing accept methods
responsibility encapsulate operations that can be applied to element objects
separate algorithms from the object structure
roleInPattern Visitor
secondaryGoal improve maintainability when adding new operations
supports double dispatch
tradeoff makes adding new element classes harder
typicallyDefinedIn class diagrams of Visitor pattern
typicalNamingConvention ConcreteVisitorX or specific domain-related names
usedIn behavioral design patterns
object-oriented design
variesWith algorithms applied to elements

Referenced by (1)

Full triples — surface form annotated when it differs from this entity's canonical label.

Visitor typicalParticipants ConcreteVisitor