On 23 Sep 2009, at 18:23, Manik Surtani wrote:
In general though, the problem with the visitor pattern is that it
does not work well for situations where you have an arbitrary (and
dynamically changing) number of command types. Visitors worked well
for us for invocations since we have a small and finite set of API
commands that do not change often. I think it also works for
configuration since again, there are a few high-level "classes" of
features encapsulated by a ConfigurationBean impl. So again, small
and finite set, doesn't change often. So within these constraints,
there should be no need for weakly typed method invocations via
reflection. :)
My personal rule of thumb - if a reflection-based visitor approach is
to be considered, then this is a bad application for the visitor
pattern.
+1. reflection-based visitor sounds like an oxymoron to me :-)