Void’s Vault

Knowledge source for efficiency.

Avoid the Unavoidable Visitor’s Cycle of Dependencies

I got a quick tip. I had to implement a visitor pattern (as in GOF’s book, “Design Patterns”, go read it). After it was done, I suddenly realized that this class had created an enormous cycle of dependencies in my program. It is a problem inherent to the pattern when implemented in C++, C#, Java and in any other static languages.

Fortunately, Uncle Bob found a solution and posted it

Keep code clean!