Re: When and where to use Visitor Pattern?
- From: Rich MacDonald <rich@@clevercaboose.com>
- Date: Sat, 30 Apr 2005 13:47:19 GMT
"Ilja Preuß" <it@xxxxxxxxxxxxx> wrote in
news:427317a0@xxxxxxxxxxxxxxxxxxxxxxx:
> paul campbell wrote:
>
>> Yes the visitor is great at decoupling. Its especially good at
>> "decoupling" all that useful positional context information that is
>> essential to just about
>> every graph traversal problem Ive ever encoutered :).
>
> [snip] In my experience, there actually are graph traversal
> problems that don't need positional context information, or can be
> transformed to one that doesn't.
How about an object that simply gathers the "parent-child" information in
a graph, then forwards the data to an object that does need such
"positional context information"? Is this sufficient for what we're
talking about. IOW, what is meant by "positional context information"?
If this is satisfactory, then Visitor can be used as an intermediate to
extract the information without requiring the Visitee objects to
implement that capability.
> - For some problems, the Visitor pattern actually is quite easy to
> extend so that it takes positional context information into account.
My thoughts exactly, although I'm unclear what is exactly meant by this.
Example?
> - Nevertheless there are certainly graph traversal problems for which
> Visitor isn't the best solution.
I'd like to see an example posted. Got my hammer ready :-)
.
- References:
- When and where to use Visitor Pattern?
- From: Sam Hwang
- Re: When and where to use Visitor Pattern?
- From: Ilja Preuß
- Re: When and where to use Visitor Pattern?
- From: paul campbell
- Re: When and where to use Visitor Pattern?
- From: Ilja Preuß
- When and where to use Visitor Pattern?
- Prev by Date: Re: When and where to use Visitor Pattern?
- Next by Date: Re: Lahman, how ya doing?
- Previous by thread: Re: When and where to use Visitor Pattern?
- Next by thread: Re: When and where to use Visitor Pattern?
- Index(es):