Re: When and where to use Visitor Pattern?
- From: Nicholls.Mark@xxxxxxxxx
- Date: 29 Apr 2005 02:47:04 -0700
>>There doesn't seem to be a fundumental difference here.
>There is a huge difference in the execution timeline. There is also a
>big difference in the dependency structure.
There does seem to be a difference in execution time and dependendency.
The visitor (to me) exhibits the more coupling of the options, because
it forces any usage to be coupled to all visititable types, while "if
(instanceof(xyz))" only depends on those explicitly stated......this
may or may not be necessary....in general the safest way is to assume
that making a decision based on the type/interface of a object is
intrinsically linked to all possibilities....visitor enforces
this.....the "if (instanceof(xyz))"....doesn't.
I prefer the safety and the coupling, because I think it is safer to
assume this logic is coupled, than isn't.
To me the omision of a dependency that does exist is as bad (if not
worse) that the inclusion of one that doesn't. i.e. if coupling is
inherent it should exist in the code.
.
- Follow-Ups:
- Re: When and where to use Visitor Pattern?
- From: Robert C . Martin
- Re: When and where to use Visitor Pattern?
- 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: Rich MacDonald
- Re: When and where to use Visitor Pattern?
- From: Daniel Parker
- Re: When and where to use Visitor Pattern?
- From: Robert C . Martin
- Re: When and where to use Visitor Pattern?
- From: Daniel Parker
- Re: When and where to use Visitor Pattern?
- From: Robert C . Martin
- When and where to use Visitor Pattern?
- Prev by Date: [Q] XP and Estimation
- Next by Date: Re: Confusion about splitting classes to allow sharing of resources
- Previous by thread: Re: When and where to use Visitor Pattern?
- Next by thread: Re: When and where to use Visitor Pattern?
- Index(es):
Relevant Pages
|