Well it depends (as usual). I prefer type checking when I only need to get some properties (that are not in the common interface). Or, which was the case when I found this feature, there was too much (legacy) code (that is executed based on the concrete business class) that I could not move to another class or place. In any other case I would indeed prefer the Visitor pattern.
Why do you prefer to use the Visitor pattern?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Well it depends (as usual). I prefer type checking when I only need to get some properties (that are not in the common interface). Or, which was the case when I found this feature, there was too much (legacy) code (that is executed based on the concrete business class) that I could not move to another class or place. In any other case I would indeed prefer the Visitor pattern.
Why do you prefer to use the Visitor pattern?