CACrown ArchivesHistory · sources · collections
Menu
Research dossier · General Reference

Visitor pattern

design pattern

Cross-disciplinary reference desk with index cards, atlas, dictionary and catalogue
General referenceInterpretive dossier study · Crown Archives visual atlas
Record originEnglish Wikipedia
Text licenseCC BY-SA 4.0
Source revisionFeb 9, 2026
Entity authorityQ830719
Source-derived summary

A visitor pattern is a software design pattern that separates the algorithm from the object 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 and software engineering.

In essence, the visitor allows adding new virtual functions 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 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 Gang of Four design patterns.

Problems the 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 described by the pattern

Define a separate (visitor) object that implements an operation to be performed on elements of an object structure.

Editorial summary

“Visitor pattern” enters the record as design pattern. Crown Archives preserves that source wording while asking what Visitor, pattern and design can confirm, complicate or overturn.

Editorial reviewA dependable orientation record for establishing vocabulary, names and a first evidence trail. The current 262-word lead offers orientation but no explicit four-digit date, so chronology should not be assumed. The selected authority fields contribute no independent date. Its strongest next move is a source search built around Visitor, pattern and design.
Editorial analysis

Why this record matters

“Visitor pattern” is worth following because a concise public description often conceals a longer documentary argument. Here, Visitor, pattern and design provides the most credible route into that argument.

Evidence profile

The citation trail is more important than the brevity of the summary: it shows where individual claims can be examined in context. The source revision retrieved here is dated Feb 9, 2026. The linked authority identifier is Q830719. None of the 0 selected statements returned an explicit reference.

Critical limits

A concise general-reference account can conceal disagreements about scope, terminology or the weight assigned to individual sources. The lead is largely declarative, so disagreement and counter-evidence require a deliberate search beyond the opening account. Authority statements aid reconciliation but still require their own references, qualifiers and ranks to be checked.

How to read it

Use the entry as an orientation point, then follow its citations and revision history. Names, dates and institutional relationships should be checked against the original record.

Best used for
  • Subject orientation
  • Search vocabulary
  • Locating named sources
Verify next

The closest primary source, responsible institution and strongest cited specialist reference.

Three-step research path

  1. Establish the record: confirm the title “Visitor pattern”, its source revision and the description used here.
  2. Expand the search: follow Visitor pattern primary sources, Visitor pattern archive and Visitor research across catalogues and specialist indexes.
  3. Test the account: compare the strongest cited source with the responsible institution’s current record and note any disagreement.

Questions for further research

  1. Which source most directly establishes the central claim about “Visitor pattern”?
  2. What terminology or title could unlock a more precise catalogue search?
  3. Which institution is responsible for the underlying evidence?
Subject index

Search terms from this dossier

Source & attribution

This entry incorporates text from Visitor pattern” on English Wikipedia. Contributors are listed in the page history. Text is available under the Creative Commons Attribution-ShareAlike 4.0 License. Selected authority identifiers and statements are retrieved from Wikidata under CC0; their references and qualifiers remain part of the verification path.