Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 881 Bytes

README.md

File metadata and controls

22 lines (18 loc) · 881 Bytes

Visitor Pattern

Type

The Visitor Design Pattern is a behavioral pattern.

Description

The visitor design pattern gives you the ability to add new operations to existing object without modifying the existing objects.

Use

  1. When you have an already working codebase, currently running on production.
  2. When you want to add a function but it deviates from the primary goal.

Prevent

  1. From breaking the already working codebase because of a potential bug in your changes.
  2. From making your code fragile and very time expensive to modify.

Structure

alt text

Example

alt text

References

  1. https://refactoring.guru/design-patterns/visitor
  2. https://youtu.be/TeZqKnC2gvA