From 04d80f05c8e4ce5a9a2b0124a4011baf3c7215b1 Mon Sep 17 00:00:00 2001 From: Argyro-Sioziou Date: Thu, 14 Jun 2018 17:56:14 +0300 Subject: [PATCH] Adding consequences in README.md --- acyclic-visitor/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/acyclic-visitor/README.md b/acyclic-visitor/README.md index 33c894ce7..939fe38b9 100644 --- a/acyclic-visitor/README.md +++ b/acyclic-visitor/README.md @@ -22,6 +22,16 @@ 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. +## Consequences +The good: +* 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: +* Violates the principle of least surprise or Liskov's 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. + ## Related patterns * [Visitor Pattern](../visitor/README.md)