From 89d9558b001358a8d5ce4ba23b9ccdd9859bbeea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sun, 25 Feb 2024 13:43:27 +0200 Subject: [PATCH] docs: Improvements to Acyclic Visitor readme --- acyclic-visitor/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/acyclic-visitor/README.md b/acyclic-visitor/README.md index 464fcc51f..bf6307e73 100644 --- a/acyclic-visitor/README.md +++ b/acyclic-visitor/README.md @@ -8,8 +8,7 @@ tag: ## Intent -Allow new functions to be added to existing class hierarchies without affecting those hierarchies, and without creating -the troublesome dependency cycles that are inherent to the GoF Visitor Pattern. +The Acyclic Visitor pattern decouples operations from an object hierarchy, allowing you to add new operations without modifying the object structure directly. ## Explanation @@ -135,19 +134,19 @@ This pattern can be used: * When the visited class hierarchy will be frequently extended with new derivatives of the Element class. * When the recompilation, relinking, retesting or redistribution of the derivatives of Element is very expensive. -## Tutorial +## Tutorials * [Acyclic Visitor Pattern Example](https://codecrafter.blogspot.com/2012/12/the-acyclic-visitor-pattern.html) ## Consequences -The good: +Benefits: * No dependency cycles between class hierarchies. * No need to recompile all the visitors if a new one is added. * Does not cause compilation failure in existing visitors if class hierarchy has a new member. -The bad: +Trade-offs: * Violates [Liskov's Substitution Principle](https://java-design-patterns.com/principles/#liskov-substitution-principle) by showing that it can accept all visitors but actually only being interested in particular visitors. * Parallel hierarchy of visitors has to be created for all members in visitable class hierarchy.