Re: When and where to use Visitor Pattern?



"Daniel Parker" <danielaparker@spam?nothanks.windupbird.com> wrote in
message news:FTEbe.5158$BW6.703155@xxxxxxxxxxxxxxxxxxxxxxxx
> "Rich MacDonald" <rich@@clevercaboose.com> wrote in message
> news:Xns9644C928CC626richclevercaboosecom@xxxxxxxxxxxxxxx
>
>> Done well, I consider it the most useful and powerful pattern I know.
>
> I think it's fair to point out, though, that this sentiment is not
> universal, see for example http://nice.sourceforge.net/visitor.html. To
> the extent that the vistor pattern is just a poor man's substitute for
> multimethods, wouldn't "instanceof" do just as well? And be a little
> clearer? With less clutter in the core class (no visit method)?

Using the acyclic variety of Visitor pattern overcomes the most important of
the objections listed in the web page you cited. See the paper titled
"Acyclic Visitor" at the publications section of the Object Mentor web site
(http://www.objectmentor.com) for more info.

--
Roger L. Cauvin
nospam_roger@xxxxxxxxxx (omit the "nospam_" part)
Cauvin, Inc.
Product Management / Market Research
http://www.cauvin-inc.com


.