A visitor pattern is a
software design pattern
In software engineering, a software design pattern or design pattern is a general, reusable solution to a commonly occurring problem in many contexts in software design. A design pattern is not a rigid structure to be transplanted directly into s ...
that separates the
algorithm
In mathematics and computer science, an algorithm () is a finite sequence of Rigour#Mathematics, mathematically rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algo ...
from the
object
Object may refer to:
General meanings
* Object (philosophy), a thing, being, or concept
** Object (abstract), an object which does not exist at any particular time or place
** Physical object, an identifiable collection of matter
* Goal, an a ...
structure. Because of this separation, new operations can be added to existing object structures without modifying the structures. It is one way to follow the
open/closed principle in
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impl ...
and
software engineering
Software engineering is a branch of both computer science and engineering focused on designing, developing, testing, and maintaining Application software, software applications. It involves applying engineering design process, engineering principl ...
.
In essence, the visitor allows adding new
virtual function
In object-oriented programming such as is often used in C++ and Object Pascal, a virtual function or virtual method is an inheritable and overridable function or method that is dispatched dynamically. Virtual functions are an important part ...
s to a family of
classes, without modifying the classes. Instead, a visitor class is created that implements all of the appropriate specializations of the virtual function. The visitor takes the instance reference as input, and implements the goal through
double dispatch.
Programming languages with
sum types and
pattern matching
In computer science, pattern matching is the act of checking a given sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually must be exact: "either it will or will not be a ...
obviate many of the benefits of the visitor pattern, as the visitor class is able to both easily branch on the type of the object and generate a compiler error if a new object type is defined which the visitor does not yet handle.
Overview
The Visitor
design pattern is one of the twenty-three well-known ''
Gang of Four design patterns''
that describe how to solve recurring design problems to design flexible and reusable object-oriented software, that is,
objects that are easier to implement, change, test, and reuse.
Problems, the Visitor design pattern can solve
* It should be possible to define a new operation for (some) classes of an object structure without changing the classes.
When new operations are needed frequently and the object structure consists of many unrelated classes,
it's inflexible to add new subclasses each time a new operation is required
because "
.distributing all these operations across the various node classes leads to a system that's hard to understand, maintain, and change."
Solution, the Visitor design pattern describes
* Define a separate (visitor) object that implements an operation to be performed on elements of an object structure.
* Clients traverse the object structure and call a ''dispatching operation accept (visitor)'' on an element — that "dispatches" (delegates) the request to the "accepted visitor object". The visitor object then performs the operation on the element ("visits the element").
This makes it possible to create new operations independently from the classes of an object structure
by adding new visitor objects.
See also the UML class and sequence diagram below.
Definition
The
Gang of Four
The Gang of Four () was a Maoist political faction composed of four Chinese Communist Party (CCP) officials. They came to prominence during the Cultural Revolution (1966–1976) and were later charged with a series of treasonous crimes due to th ...
defines the Visitor as:
The nature of the Visitor makes it an ideal pattern to plug into public APIs, thus allowing its clients to perform operations on a class using a "visiting" class without having to modify the source.
Advantages
Moving operations into visitor classes is beneficial when
* many unrelated operations on an object structure are required,
* the classes that make up the object structure are known and not expected to change,
* new operations need to be added frequently,
* an algorithm involves several classes of the object structure, but it is desired to manage it in one single location,
* an algorithm needs to work across several independent class hierarchies.
A drawback to this pattern, however, is that it makes extensions to the class hierarchy more difficult, as new classes typically require a new
visit
method to be added to each visitor.
Application
Consider the design of a 2D
computer-aided design
Computer-aided design (CAD) is the use of computers (or ) to aid in the creation, modification, analysis, or optimization of a design. This software is used to increase the productivity of the designer, improve the quality of design, improve c ...
(CAD) system. At its core, there are several types to represent basic geometric shapes like circles, lines, and arcs. The entities are ordered into layers, and at the top of the type hierarchy is the drawing, which is simply a list of layers, plus some added properties.
A fundamental operation on this type hierarchy is saving a drawing to the system's native file format. At first glance, it may seem acceptable to add local save methods to all types in the hierarchy. But it is also useful to be able to save drawings to other file formats. Adding ever more methods for saving into many different file formats soon clutters the relatively pure original geometric data structure.
A naive way to solve this would be to maintain separate functions for each file format. Such a save function would take a drawing as input, traverse it, and encode into that specific file format. As this is done for each added different format, duplication between the functions accumulates. For example, saving a circle shape in a raster format requires very similar code no matter what specific raster form is used, and is different from other primitive shapes. The case for other primitive shapes like lines and polygons is similar. Thus, the code becomes a large outer loop traversing through the objects, with a large decision tree inside the loop querying the type of the object. Another problem with this approach is that it is very easy to miss a shape in one or more savers, or a new primitive shape is introduced, but the save routine is implemented only for one file type and not others, leading to code extension and maintenance problems. As the versions of the same file grows it becomes more complicated to maintain it.
Instead, the visitor pattern can be applied. It encodes the logical operation (i.e. save(image_tree)) on the whole hierarchy into one class (i.e. Saver) that implements the common methods for traversing the tree and describes virtual helper methods (i.e. save_circle, save_square, etc.) to be implemented for format specific behaviors. In the case of the CAD example, such format specific behaviors would be implemented by a subclass of Visitor (i.e. SaverPNG). As such, all duplication of type checks and traversal steps is removed. Additionally, the compiler now complains if a shape is omitted since it is now expected by the common base traversal/save function.
Iteration loops
The visitor pattern may be used for iteration over
container
A container is any receptacle or enclosure for holding a product used in storage, packaging, and transportation, including shipping.
Things kept inside of a container are protected on several sides by being inside of its structure. The term ...
-like data structures just like
Iterator pattern but with limited functionality.
For example,
iteration
Iteration is the repetition of a process in order to generate a (possibly unbounded) sequence of outcomes. Each repetition of the process is a single iteration, and the outcome of each iteration is then the starting point of the next iteration.
...
over a directory structure could be implemented by a function class instead of more conventional
loop pattern. This would allow deriving various useful information from directories content by implementing a visitor functionality for every item while
reusing the iteration code. It's widely employed in Smalltalk systems and can be found in C++ as well. A drawback of this approach, however, is that you can't break out of the loop easily or iterate concurrently (in parallel i.e. traversing two containers at the same time by a single variable). The latter would require writing additional functionality for a visitor to support these features.
Structure
UML class and sequence diagram
In the
UML class diagram
In software engineering,
a class diagram
in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, operations (or methods), and the re ...
above, the
ElementA
class doesn't implement a new operation directly.
Instead,
ElementA
implements a ''dispatching operation''
accept(visitor)
that "dispatches" (delegates) a request to the "accepted visitor object" (
visitor.visitElementA(this)
). The
Visitor1
class implements the operation (
visitElementA(e:ElementA)
).
ElementB
then implements
accept(visitor)
by dispatching to
visitor.visitElementB(this)
. The
Visitor1
class implements the operation (
visitElementB(e:ElementB)
).
The
UML sequence diagram
In software engineering, a sequence diagram
shows process interactions arranged in time sequence. This diagram depicts the processes and objects involved and the sequence of messages exchanged as needed to carry out the functionality. Sequence ...
shows the run-time interactions: The
Client
object traverses the elements of an object structure (
ElementA,ElementB
) and calls
accept(visitor)
on each element.
First, the
Client
calls
accept(visitor)
on
ElementA
, which calls
visitElementA(this)
on the accepted
visitor
object.
The element itself (
this
) is passed to the
visitor
so that
it can "visit"
ElementA
(call
operationA()
).
Thereafter, the
Client
calls
accept(visitor)
on
ElementB
, which calls
visitElementB(this)
on the
visitor
that "visits"
ElementB
(calls
operationB()
).
Class diagram
Details
The visitor pattern requires a
programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
that supports
single dispatch
In computer science, dynamic dispatch is the process of selecting which implementation of a polymorphic operation (method or function) to call at run time. It is commonly employed in, and considered a prime characteristic of, object-oriented ...
, as common object-oriented languages (such as
C++,
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
,
Smalltalk
Smalltalk is a purely object oriented programming language (OOP) that was originally created in the 1970s for educational use, specifically for constructionist learning, but later found use in business. It was created at Xerox PARC by Learni ...
,
Objective-C
Objective-C is a high-level general-purpose, object-oriented programming language that adds Smalltalk-style message passing (messaging) to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was ...
,
Swift
Swift or SWIFT most commonly refers to:
* SWIFT, an international organization facilitating transactions between banks
** SWIFT code
* Swift (programming language)
* Swift (bird), a family of birds
It may also refer to:
Organizations
* SWIF ...
,
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
,
Python and
C#) do. Under this condition, consider two objects, each of some class type; one is termed the ''element'', and the other is ''visitor''.
Objects
Visitor
The ''visitor'' declares a
visit
method, which takes the element as an argument, for each class of element. ''Concrete visitors'' are derived from the visitor class and implement these
visit
methods, each of which implements part of the algorithm operating on the object structure. The state of the algorithm is maintained locally by the concrete visitor class.
Element
The ''element'' declares an
accept
method to accept a visitor, taking the visitor as an argument. ''Concrete elements'', derived from the element class, implement the
accept
method. In its simplest form, this is no more than a call to the visitor's
visit
method.
Composite elements, which maintain a list of child objects, typically iterate over these, calling each child's
accept
method.
Client
The ''client'' creates the object structure, directly or indirectly, and instantiates the concrete visitors. When an operation is to be performed which is implemented using the Visitor pattern, it calls the
accept
method of the top-level element(s).
Methods
Accept
When the
accept
method is called in the program, its implementation is chosen based on both the dynamic type of the element and the static type of the visitor. When the associated
visit
method is called, its implementation is chosen based on both the dynamic type of the visitor and the static type of the element, as known from within the implementation of the
accept
method, which is the same as the dynamic type of the element. (As a bonus, if the visitor can't handle an argument of the given element's type, then the compiler will catch the error.)
Visit
Thus, the implementation of the
visit
method is chosen based on both the dynamic type of the element and the dynamic type of the visitor. This effectively implements
double dispatch. For languages whose object systems support multiple dispatch, not only single dispatch, such as
Common Lisp
Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ''ANSI INCITS 226-1994 (S2018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperli ...
or
C# via the
Dynamic Language Runtime
The Dynamic Language Runtime (DLR) from Microsoft runs on top of the Common Language Runtime (CLR) and provides computer language services for dynamic languages. These services include:
* A dynamic type system, to be shared by all languages using ...
(DLR), implementation of the visitor pattern is greatly simplified (a.k.a. Dynamic Visitor) by allowing use of simple function overloading to cover all the cases being visited. A dynamic visitor, provided it operates on public data only, conforms to the
open/closed principle (since it does not modify extant structures) and to the
single responsibility principle
The single-responsibility principle (SRP) is a computer programming principle that states that "A module should be responsible to one, and only one, actor." The term actor refers to a group (consisting of one or more stakeholders or users) that ...
(since it implements the Visitor pattern in a separate component).
In this way, one algorithm can be written to traverse a graph of elements, and many different kinds of operations can be performed during that traversal by supplying different kinds of visitors to interact with the elements based on the dynamic types of both the elements and the visitors.
Examples
C#
This example declares a separate
ExpressionPrintingVisitor
class that takes care of the printing. If the introduction of a new concrete visitor is desired, a new class will be created to implement the Visitor interface, and new implementations for the Visit methods will be provided. The existing classes (Literal and Addition) will remain unchanged.
using System;
namespace Wikipedia;
public interface Visitor
public class ExpressionPrintingVisitor : Visitor
public abstract class Expression
public class Literal : Expression
public class Addition : Expression
public static class Program
Smalltalk
In this case, it is the object's responsibility to know how to print itself on a stream. The visitor here is then the object, not the stream.
"There's no syntax for creating a class. Classes are created by sending messages to other classes."
WriteStream subclass: #ExpressionPrinter
instanceVariableNames: ''
classVariableNames: ''
package: 'Wikipedia'.
ExpressionPrinter>>write: anObject
"Delegates the action to the object. The object doesn't need to be of any special
class; it only needs to be able to understand the message #putOn:"
anObject putOn: self.
^ anObject.
Object subclass: #Expression
instanceVariableNames: ''
classVariableNames: ''
package: 'Wikipedia'.
Expression subclass: #Literal
instanceVariableNames: 'value'
classVariableNames: ''
package: 'Wikipedia'.
Literal class>>with: aValue
"Class method for building an instance of the Literal class"
^ self new
value: aValue;
yourself.
Literal>>value: aValue
"Setter for value"
value := aValue.
Literal>>putOn: aStream
"A Literal object knows how to print itself"
aStream nextPutAll: value asString.
Expression subclass: #Addition
instanceVariableNames: 'left right'
classVariableNames: ''
package: 'Wikipedia'.
Addition class>>left: a right: b
"Class method for building an instance of the Addition class"
^ self new
left: a;
right: b;
yourself.
Addition>>left: anExpression
"Setter for left"
left := anExpression.
Addition>>right: anExpression
"Setter for right"
right := anExpression.
Addition>>putOn: aStream
"An Addition object knows how to print itself"
aStream nextPut: $(.
left putOn: aStream.
aStream nextPut: $+.
right putOn: aStream.
aStream nextPut: $).
Object subclass: #Program
instanceVariableNames: ''
classVariableNames: ''
package: 'Wikipedia'.
Program>>main
, expression stream ,
expression := Addition
left: (Addition
left: (Literal with: 1)
right: (Literal with: 2))
right: (Literal with: 3).
stream := ExpressionPrinter on: (String new: 100).
stream write: expression.
Transcript show: stream contents.
Transcript flush.
Go
Go does not support method overloading, so the visit methods need different names. A typical visitor interface might be
type Visitor interface
Java
The following example is in the language
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
, and shows how the contents of a tree of nodes (in this case describing the components of a car) can be printed. Instead of creating
print
methods for each node subclass (
Wheel
,
Engine
,
Body
, and
Car
), one visitor class (
CarElementPrintVisitor
) performs the required printing action. Because different node subclasses require slightly different actions to print properly,
CarElementPrintVisitor
dispatches actions based on the class of the argument passed to its
visit
method.
CarElementDoVisitor
, which is analogous to a save operation for a different file format, does likewise.
Diagram
Sources
import java.util.List;
interface CarElement
interface CarElementVisitor
class Wheel implements CarElement
class Body implements CarElement
class Engine implements CarElement
class Car implements CarElement
class CarElementDoVisitor implements CarElementVisitor
class CarElementPrintVisitor implements CarElementVisitor
public class VisitorDemo
Output
Visiting front left wheel
Visiting front right wheel
Visiting back left wheel
Visiting back right wheel
Visiting body
Visiting engine
Visiting car
Kicking my front left wheel
Kicking my front right wheel
Kicking my back left wheel
Kicking my back right wheel
Moving my body
Starting my engine
Starting my car
Common Lisp
Sources
(defclass auto ()
((elements :initarg :elements)))
(defclass auto-part ()
((name :initarg :name :initform "")))
(defmethod print-object ((p auto-part) stream)
(print-object (slot-value p 'name) stream))
(defclass wheel (auto-part) ())
(defclass body (auto-part) ())
(defclass engine (auto-part) ())
(defgeneric traverse (function object other-object))
(defmethod traverse (function (a auto) other-object)
(with-slots (elements) a
(dolist (e elements)
(funcall function e other-object))))
;; do-something visitations
;; catch all
(defmethod do-something (object other-object)
(format t "don't know how ~s and ~s should interact~%" object other-object))
;; visitation involving wheel and integer
(defmethod do-something ((object wheel) (other-object integer))
(format t "kicking wheel ~s ~s times~%" object other-object))
;; visitation involving wheel and symbol
(defmethod do-something ((object wheel) (other-object symbol))
(format t "kicking wheel ~s symbolically using symbol ~s~%" object other-object))
(defmethod do-something ((object engine) (other-object integer))
(format t "starting engine ~s ~s times~%" object other-object))
(defmethod do-something ((object engine) (other-object symbol))
(format t "starting engine ~s symbolically using symbol ~s~%" object other-object))
(let ((a (make-instance 'auto
:elements `(,(make-instance 'wheel :name "front-left-wheel")
,(make-instance 'wheel :name "front-right-wheel")
,(make-instance 'wheel :name "rear-left-wheel")
,(make-instance 'wheel :name "rear-right-wheel")
,(make-instance 'body :name "body")
,(make-instance 'engine :name "engine")))))
;; traverse to print elements
;; stream *standard-output* plays the role of other-object here
(traverse #'print a *standard-output*)
(terpri) ;; print newline
;; traverse with arbitrary context from other object
(traverse #'do-something a 42)
;; traverse with arbitrary context from other object
(traverse #'do-something a 'abc))
Output
"front-left-wheel"
"front-right-wheel"
"rear-left-wheel"
"rear-right-wheel"
"body"
"engine"
kicking wheel "front-left-wheel" 42 times
kicking wheel "front-right-wheel" 42 times
kicking wheel "rear-left-wheel" 42 times
kicking wheel "rear-right-wheel" 42 times
don't know how "body" and 42 should interact
starting engine "engine" 42 times
kicking wheel "front-left-wheel" symbolically using symbol ABC
kicking wheel "front-right-wheel" symbolically using symbol ABC
kicking wheel "rear-left-wheel" symbolically using symbol ABC
kicking wheel "rear-right-wheel" symbolically using symbol ABC
don't know how "body" and ABC should interact
starting engine "engine" symbolically using symbol ABC
Notes
The
other-object
parameter is superfluous in
traverse
. The reason is that it is possible to use an anonymous function that calls the desired target method with a lexically captured object:
(defmethod traverse (function (a auto)) ;; other-object removed
(with-slots (elements) a
(dolist (e elements)
(funcall function e)))) ;; from here too
;; ...
;; alternative way to print-traverse
(traverse (lambda (o) (print o *standard-output*)) a)
;; alternative way to do-something with
;; elements of a and integer 42
(traverse (lambda (o) (do-something o 42)) a)
Now, the multiple dispatch occurs in the call issued from the body of the anonymous function, and so
traverse
is just a mapping function that distributes a function application over the elements of an object. Thus all traces of the Visitor Pattern disappear, except for the mapping function, in which there is no evidence of two objects being involved. All knowledge of there being two objects and a dispatch on their types is in the lambda function.
Python
Python does not support method overloading in the classical sense (polymorphic behavior according to type of passed parameters), so the "visit" methods for the different model types need to have different names.
Sources
"""
Visitor pattern example.
"""
from abc import ABCMeta, abstractmethod
NOT_IMPLEMENTED = "You should implement this."
class CarElement(metaclass=ABCMeta):
@abstractmethod
def accept(self, visitor):
raise NotImplementedError(NOT_IMPLEMENTED)
class Body(CarElement):
def accept(self, visitor):
visitor.visitBody(self)
class Engine(CarElement):
def accept(self, visitor):
visitor.visitEngine(self)
class Wheel(CarElement):
def __init__(self, name):
self.name = name
def accept(self, visitor):
visitor.visitWheel(self)
class Car(CarElement):
def __init__(self):
self.elements = Wheel("front left"), Wheel("front right"),
Wheel("back left"), Wheel("back right"),
Body(), Engine()
def accept(self, visitor):
for element in self.elements:
element.accept(visitor)
visitor.visitCar(self)
class CarElementVisitor(metaclass=ABCMeta):
@abstractmethod
def visitBody(self, element):
raise NotImplementedError(NOT_IMPLEMENTED)
@abstractmethod
def visitEngine(self, element):
raise NotImplementedError(NOT_IMPLEMENTED)
@abstractmethod
def visitWheel(self, element):
raise NotImplementedError(NOT_IMPLEMENTED)
@abstractmethod
def visitCar(self, element):
raise NotImplementedError(NOT_IMPLEMENTED)
class CarElementDoVisitor(CarElementVisitor):
def visitBody(self, body):
print("Moving my body.")
def visitCar(self, car):
print("Starting my car.")
def visitWheel(self, wheel):
print("Kicking my wheel.".format(wheel.name))
def visitEngine(self, engine):
print("Starting my engine.")
class CarElementPrintVisitor(CarElementVisitor):
def visitBody(self, body):
print("Visiting body.")
def visitCar(self, car):
print("Visiting car.")
def visitWheel(self, wheel):
print("Visiting wheel.".format(wheel.name))
def visitEngine(self, engine):
print("Visiting engine.")
car = Car()
car.accept(CarElementPrintVisitor())
car.accept(CarElementDoVisitor())
Output
Visiting front left wheel.
Visiting front right wheel.
Visiting back left wheel.
Visiting back right wheel.
Visiting body.
Visiting engine.
Visiting car.
Kicking my front left wheel.
Kicking my front right wheel.
Kicking my back left wheel.
Kicking my back right wheel.
Moving my body.
Starting my engine.
Starting my car.
Abstraction
Using Python 3 or above allows to make a general implementation of the accept method:
class Visitable:
def accept(self, visitor):
lookup = "visit_" + self.__qualname__.replace(".", "_")
return getattr(visitor, lookup)(self)
One could extend this to iterate over the class's method resolution order if they would like to fall back on already-implemented classes. They could also use the subclass hook feature to define the lookup in advance.
Related design patterns
*
Iterator pattern – defines a traversal principle like the visitor pattern, without making a type differentiation within the traversed objects
*
Church encoding
In mathematics, Church encoding is a means of representing data and operators in the lambda calculus. The Church numerals are a representation of the natural numbers using lambda notation. The method is named for Alonzo Church, who first encoded d ...
– a related concept from functional programming, in which
tagged union/sum types may be modeled using the behaviors of "visitors" on such types, and which enables the visitor pattern to emulate variants and
patterns
A pattern is a regularity in the world, in human-made design, or in abstract ideas. As such, the elements of a pattern repeat in a predictable manner. A geometric pattern is a kind of pattern formed of geometric shapes and typically repeated li ...
.
See also
*
Algebraic data type
In computer programming, especially functional programming and type theory, an algebraic data type (ADT) is a kind of composite data type, i.e., a data type formed by combining other types.
Two common classes of algebraic types are product ty ...
*
Double dispatch
*
Multiple dispatch
Multiple dispatch or multimethods is a feature of some programming languages in which a Subroutine, function or Method (computer programming), method can be dynamic dispatch, dynamically dispatched based on the run time (program lifecycle phase), ...
*
Function object
In computer programming, a function object is a construct allowing an object (computer science), object to be invoked or called as if it were an ordinary subroutine, function, usually with the same syntax (a function parameter that can also be a ...
References
External links
* A rough chapter from ''The Principles, Patterns, and Practices of Agile Software Development'',
Robert C. Martin, Prentice Hall
Visitor pattern in UML and in LePUS3(a Design Description Language)
* Article
Componentization: the Visitor Exampleby
Bertrand Meyer
Bertrand Meyer (; ; born 21 November 1950) is a French academic, author, and consultant in the field of computer languages. He created the Eiffel programming language and the concept of design by contract.
Education and academic career
Meyer ...
and Karine Arnout, ''Computer'' (IEEE), vol. 39, no. 7, July 2006, pages 23-30.
* Articl
A Type-theoretic Reconstruction of the Visitor Pattern* Article
The Essence of the Visitor Pattern by
Jens Palsberg Jens may refer to:
* Jens (given name), a list of people with the name
* Jens (surname), a list of people
* Jens, Switzerland, a municipality
* 1719 Jens, an asteroid
See also
* Jensen (disambiguation) Jensen may refer to:
People and fictional ...
and
C. Barry Jay. 1997
IEEE-CS COMPSAC paper showing that accept() methods are unnecessary when reflection is available; introduces term 'Walkabout' for the technique.
* Article "" by Bruce Wallace – subtitled ''"Java 1.2's reflection capabilities eliminate burdensome accept() methods from your Visitor pattern"''
Visitor Patternusing reflection(java).
Provides a context-free and type-safe implementation of the Visitor Pattern in Java based on Delegates.
Visitor Design Pattern
{{Design Patterns Patterns
Software design patterns
Programming language comparisons
Articles with example C++ code
Articles with example C Sharp code
Articles with example Java code
Articles with example Lisp (programming language) code
Articles with example Python (programming language) code
Articles with example Smalltalk code