Skip to content

Commit 9590028

Browse files
authored
Merge pull request #8 from iluwatar/master
Resync
2 parents ff637de + 0335c61 commit 9590028

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

acyclic-visitor/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Allow new functions to be added to existing class hierarchies without affecting
1717

1818
## Applicability
1919
This pattern can be used:
20+
2021
* When you need to add a new function to an existing hierarchy without the need to alter or affect that hierarchy.
2122
* When there are functions that operate upon a hierarchy, but which do not belong in the hierarchy itself. e.g. the ConfigureForDOS / ConfigureForUnix / ConfigureForX issue.
2223
* When you need to perform very different operations on an object depending upon its type.
@@ -25,11 +26,13 @@ This pattern can be used:
2526

2627
## Consequences
2728
The good:
29+
2830
* No dependency cycles between class hierarchies.
2931
* No need to recompile all the visitors if a new one is added.
3032
* Does not cause compilation failure in existing visitors if class hierarchy has a new member.
3133

3234
The bad:
35+
3336
* 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.
3437
* Parallel hierarchy of visitors has to be created for all members in visitable class hierarchy.
3538

0 commit comments

Comments
 (0)