Visitor Pattern

noun

say it: “VIZ-ih-ter PAT-urn” /ˈvɪzɪtər ˈpætərn/

A design pattern that puts each new job on a family of objects into one class with a method for each kind of object, so a new job never means editing every class.

What is Visitor Pattern?

The Visitor pattern lets you add new operations to a set of classes without editing them, by putting each operation in a separate "visitor" class that visits every object.

In a sentence

  • “With the Visitor pattern, the checker that finds unknown product kinds was one new class, and the five rule pieces didn't change.”

Level: Master · More OOP terms at this level

Updated