Author image

Visitor Design Pattern


I have to agree that this design pattern confused me for a longer time than I'd want to admit. But fear not! Confusion is now over! The time of Understanding is at hand! This cancer curing project will solve all mysteries of the Visitor pattern.

Definition: Represent an operation to be performed on elements of an object structure. Visitor lets you define a new operation without changing (recompiling) the classes of the elements on which it operates.

Understood? No? I didn't think so; keep on reading. I never understood those definitions either. They only make sense After you delve deep into it and start making sense of it on your terms!

A Visitor is a behavioral software design pattern and a good design decision if you want to perform similar kinds of operations on objects of different types that are grouped inside a...

1