DEV Community

Discussion on: Underrated design patterns

Collapse
 
tonybaines profile image
Tony Baines • Edited

I have a love-hate relationship with the Visitor pattern; sometimes it seems the best (only) way of solving the problem in front of you, but it still feels unwieldy, hard to follow and honestly a bit of a hack.

If I can, I'll treat the temptation to use Visitor as a clue that the model is wrong and refactor ;)

Collapse
 
bertilmuth profile image
Bertil Muth

What kind of problems have you solved with it? I know that it fits best when processing e.g. tree structures.

Collapse
 
tonybaines profile image
Tony Baines

Exactly - operations on a graph of objects of different classes.