Can anyone direct me to an excellent article that describe the visitor design pattern [closed]

StackOverflow https://stackoverflow.com/questions/4300018

문제

Can anyone direct me to an excellent article that describe the visitor design pattern, provided that the code is written in Java.

Thanks

도움이 되었습니까?

해결책

Google is your friend.

http://www.javaworld.com/javatips/jw-javatip98.html: And usually JavaWorld has good stuff

http://en.wikipedia.org/wiki/Visitor_pattern#Java_example: And even the wikipedia entry has a Java example that you're probably looking for.

다른 팁

You can find an excellent description of visitor pattern in "Refactoring to Patterns" of Joshua Kerievsky.
The example given in it makes everything clear. The book is not freely available though.

I've researched a lot in the Internet about this pattern. I've learned that there are several flavors of this pattern.

In particular, I've seen so many confused implementations which I decided to think more about it and design something which I could consider acceptable for my purposes.

I work with a large and complex library in Java which extensively uses the Visitor Pattern in a very clean and neat way. In particular, I don't like implementations with visitA, visitB, visitWhatever, acceptA, acceptB, acceptWhatever. This is absolutely wrong, IMHO. You don't need this. If you keep everything neat, you can have concerns separated on their respective classes and your life will be much happier.

If you have a chance, please have a look at an article I've written about this.

Cheers

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top