开发者

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

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. 开发者_JAVA技巧

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

Improve this question

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜