Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cyclic dependency in Visitor Design Pattern [closed]

Is there a way to implement visitor design pattern without cyclic dependency? What I mean is that the visitor need an object to visit. and the visited object needs a visitor to accept. In the end both depend on each other.

like image 344
user1406062 Avatar asked Oct 01 '12 11:10

user1406062


1 Answers

Found it again! Check out the Acyclic Visitor:

Quote:

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.

like image 192
ltjax Avatar answered Sep 20 '22 13:09

ltjax