Skip to content

jsilva234/understand_visitor_design_pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Understand Visitor Design Pattern

This repo is my playground exploring the Visitor pattern

This pattern is ideal for scenarios where you need to perform operations on objects of a structure without modifying their classes.

It’s particularly useful when classes are stable on their main purpose but there need to perform unrelated or unstable operations.

Here are some examples of use cases:

  • Extending functionality without modifying classes (e.g., library classes or stable structures).
  • Performing different operations on elements of a complex object structure (e.g., parsing ASTs).
  • When you have a set of related classes and need to perform a set of varied but related operations on them.
  • Avoiding bloated classes where numerous unrelated methods are added.
  • Simplifying the addition of new operations while maintaining backward compatibility.
  • Gathering information or performing transformations over a collection of objects with different types (e.g., serialization, validation, or reporting).

I would describe this as a plug and play system.

How to run this demo

    #clone repo
    python -m visitor_pattern

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages