Visitor pattern (re)visited

2010-08-02

Example of visitor pattern in Java

I am aware that the visitor design pattern has been around in some form for years and so what I’m about to write in this post is not particularly innovative or special in any way. I just thought I’d discuss something I’ve been pondering for a while in my attempts to come up with interesting refactorings for the DuctileJ project.

Anyway, I read this article describing the pattern in C# and thought I’d translate the samples into Java.

Before implementing the visitor pattern

An intermediate version

With the visitor design pattern

I’ll write more on the subject later.

Tags: Development, Design patterns, Java

All content © 2017 Richard Cook. All rights reserved.