From: Patrick May on
Nick Keighley <nick_keighley_nospam(a)hotmail.com> writes:
> On 14 Dec, 17:07, "H. S. Lahman" <h.lah...(a)verizon.net> wrote:
[ . . . ]
>> OTOH, this looks more like Visitor. Given the problem description I
>> think this solution has more unnecessary coupling than Strategy.
>
> so in the absense of any more information, the Strategy pattern
> would propably be the best way of tackeling this sort of problem?
> All those passing of self sounded a bit unnecessary to me but I
> thought I must be missing something.

For the stated goal, Strategy will help to minimize the impact of
changes to the system. It won't cover all possible changes, of
course. Mr. Lehman correctly points out that the code you posted
smells like the Visitor pattern, which allows you to add new
functionality to existing classes, whereas Strategy allows you to add
new implementations of existing functionality.

Regards,

Patrick

------------------------------------------------------------------------
S P Engineering, Inc. | Large scale, mission-critical, distributed OO
| systems design and implementation.
pjm(a)spe.com | (C++, Java, Common Lisp, Jini, middleware, SOA)