I read a book about the visitor pattern. It gives the same class diagram as in the oodesign\'s website.
It says that adding new ConcreteElement classes is hard. But I di
This came up in an SO question just recently. To quote myself from this question, and more specifically the discussion
The reason a precondition of not changing the set of entities (classes you visit) is because it forces you to implement a new VisitXYZ in each concrete visitor. But I never took much stock in that reasoning becasue if you are supporting a persistance visitor, and a text search visitor, and a print visitor, and a validation visitor and you go and add a new entity you are going to want to implement all that functionality anyway. The visitor pattern (with a common base class) just lets the compiler find the ones you forgot to implement for you.
So yes it is often said that its hard to implement addition conrete elements (or entities), but in my opinion it is hogwash.