English Reference

Word

visitor pattern

Definition

compound. a way of writing computer code that lets you add new features to a group of objects without changing the objects themselves. It helps keep different parts of a program separate and clean.

compound. a behavioural design pattern that separates an algorithm from the object structure on which it operates, allowing new operations to be defined without modifying the classes of the elements being visited.

Examples

“The developer used the visitor pattern to add export features to the document.”

“By implementing the visitor pattern, the team could add new reporting tools to the existing database structure without risking bugs in the core data classes.”

“The visitor pattern is particularly effective in compiler design, where it allows various analysis and optimization passes to traverse an abstract syntax tree without cluttering the node classes with logic.”

Examples

simple

“The developer used the visitor pattern to add export features to the document.”

contextual

“By implementing the visitor pattern, the team could add new reporting tools to the existing database structure without risking bugs in the core data classes.”

complex

“The visitor pattern is particularly effective in compiler design, where it allows various analysis and optimization passes to traverse an abstract syntax tree without cluttering the node classes with logic.”

Usage

Commonly used in object-oriented programming; typically involves an 'accept' method on the element and a 'visit' method on the visitor.

Etymology

A compound term formed from the noun visitor and the technical sense of pattern. It was formalised by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides in the 1994 publication Design Patterns: Elements of Reusable Object-Oriented Software.

Etymology adapted from Wiktionary, available under CC BY-SA 4.0.

Domain

Programming

This entry

Exam level
CambridgeCambridgeCambridge English QualificationsThe exam suite from Cambridge University Press & Assessment, from A1 Movers up to C2 Proficiency. The benchmark names double as CEFR labels.C2 ProficiencyIELTSIELTSInternational English Language Testing SystemThe 0–9 band test co-owned by the British Council, IDP, and Cambridge. Used for university entry, work, and migration.8.5–9.0TOEFL iBTTOEFL iBTTest of English as a Foreign Language, Internet-Based TestETS's academic English test, the standard route for US university admissions. Scored 0–120, with a 1–6 scale since 2026.1–6 scale: 6.0114–120
Level
C2 · Proficiency
Updated

QR code

englishreference.com/q/visitor-pattern

English Reference