2018-06-14 11:59:02 +03:00
..
2018-05-27 17:07:34 +03:00
2018-06-14 11:59:02 +03:00
2018-05-27 15:49:35 +03:00
2018-05-27 17:10:20 +03:00

layout, title, folder, permalink, categories, tags
layout title folder permalink categories tags
pattern Acyclic Visitor acyclic-visitor /patterns/acyclic-visitor/ Behavioral
Java
Difficulty-Intermediate

alt text

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.

Applicability

This pattern can be used:

  • When you need to add a new function to an existing hierarchy without the need to alter or affect that hierarchy.
  • 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.
  • When you need to perform very different operations on an object depending upon its type.
  • 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.

Credits