Design Patterns · Senior · Question 43 of 75

When is the Visitor pattern justified in a TypeScript project?

Explanation

Visitor is handy for ASTs, documents and editor block trees: new operations (rendering, export, validation) are added without changing the nodes. If new nodes are added often, every visitor has to change - that's the expression problem.

Further reading

Problem with a question

Design Patterns · Senior · question 43

Test yourself

Take the Design Patterns · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz