Skip to content

Add new operations to existing object without modifying the existing objects.

Notifications You must be signed in to change notification settings

design-pattern-list/visitor-pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

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

About

Add new operations to existing object without modifying the existing objects.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages