"Florian Frank" <flori / nixe.ping.de> schrieb im Newsbeitrag
news:5212262A-B848-11D8-8806-000A956A6906 / nixe.ping.de...
>
> On 06.06.2004, at 19:23, Sean O'Dell wrote:
> > Please go into detail on this.  Why would type checking be an
> > indication of
> > weak OO design?
>
> You can usually get rid of those checks by using polymorphism. In Ruby
> it's
> possible to get rid of them without using inheritace but using duck
> typing
> instead. Consider this refactoring:

<snip/>

That's exactly what I meant.  Without going into more detail about proper
OO, this kind of refactoring is not always a good solution: in some
situations you don't want the algorithm "do_it" present in the class
given, because it fits better with the invoking class than the class A,
class B class hierarchy.  In those cases often visitor pattern is applied.

Kind regards

    robert