Lecture overview -- Keyboard shortcut: 'u'  Previous page: The fragile base class problem -- Keyboard shortcut: 'p'  Next page: Natural object-oriented IntSequence traversals -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 33 : 37
Object-oriented Programming in C#
Abstract classes, Interfaces, and Patterns
The Visitor design pattern

Visitor organizes operations on Composites which need to traverse the Component nodes

A template of the class structure in the Composite design pattern.

  • The natural object-oriented solution:

    • One method per operation per Component class

  • The Visitor solution

    • All methods that pertain to a given operation are refactored and encapsulated in its own class