CSC/ECE 517 Fall 2012/ch2b 2w51 aa: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:


For more information on the Visitor pattern, you can visit the following links
For more information on the Visitor pattern, you can visit the following links
* http://kasunpanorama.blogspot.com/2010/04/understanding-visitor-pattern.html : This page can provide more introductory information on visitor pattern
* http://kasunpanorama.blogspot.com/2010/04/understanding-visitor-pattern.html  
This page can provide more introductory information on visitor pattern


* http://en.wikipedia.org/wiki/Visitor_pattern : Wikipedia provides a good condensed view on the topic of the Visitor pattern.  
* http://en.wikipedia.org/wiki/Visitor_pattern  
Wikipedia provides a good condensed view on the topic of the Visitor pattern.  


==Motivation==
==Motivation==


Now that some information is present about what the Visitor pattern is and what it should do, let us explore the motivation behind using the Visitor pattern. Some links are provided for the reader to explore the topic and a brief summary is presented to guide the reader
Now that some information is present about what the Visitor pattern is and what it should do, let us explore the motivation behind using the Visitor pattern. Some links are provided for the reader to explore the topic and a brief summary is presented to guide the reader
* http://en.wikipedia.org/wiki/Visitor_pattern - Motivation for visitor patterns is nicely depicted in Wikipedia for Visitor pattern.
* http://en.wikipedia.org/wiki/Visitor_pattern  
Motivation for visitor patterns is nicely depicted in Wikipedia for Visitor pattern.


* http://www.oodesign.com/visitor-pattern.html - One of the top visited sites for design pattern basics to implementation, oodesign.com has good introduction, implementation details.
* http://www.oodesign.com/visitor-pattern.html  
One of the top visited sites for design pattern basics , oodesign.com has good introduction, examples and implementation details. Sample code is also available for the reader. The article is good not only from the point of view of explaining the motivation behind Visitor patterns, but also because it follows a good flow in setting up the topic, explanation using examples and concluding with a brief summary


* http://sourcemaking.com/design_patterns/visitor This page has good detailed description of visitor pattern and the worth reading part is the discussion section of this page which also talks about how double dispatch is related to visitor.
* http://sourcemaking.com/design_patterns/visitor  
This page has good detailed description of visitor pattern and the worth reading part is the discussion section of this page which also talks about how double dispatch is related to visitor.
 
* http://www.dofactory.com/Patterns/PatternVisitor.aspx
Simple introductory page which describes and talks about the pattern in short. It is a very 'bare-bones' reference article, but is a good introductory piece


* http://www.dofactory.com/Patterns/PatternVisitor.aspx - Simple introductory page which describes and talks about the pattern in short.
==Visitor Pattern in Java==
==Visitor Pattern in Java==
(1) http://java.dzone.com/articles/design-patterns-visitor
(1) http://java.dzone.com/articles/design-patterns-visitor
Line 30: Line 37:
Following are the links which provides examples based on C++:
Following are the links which provides examples based on C++:


* http://sourcemaking.com/design_patterns/visitor/cpp/1
* http://sourcemaking.com/design_patterns/visitor/cpp/1 A comparison is provided between the 'before' and 'after' code based on the Visitor pattern implementation. This link and the next couple of links are part of the same discussion provided here : http://sourcemaking.com/design_patterns/visitor
 
* http://sourcemaking.com/design_patterns/visitor/cpp/2


* http://sourcemaking.com/design_patterns/visitor/cpp/3
* http://sourcemaking.com/design_patterns/visitor/cpp/3


* http://sourcemaking.com/design_patterns/visitor/cpp/2
* http://www.swe.uni-linz.ac.at/research/deco/designPatterns/visitor/visitor.defaultroles.c++.html
 
This page explains visitor pattern in detail from the basics upto implementation using C++ as language. It has implementation details and also have discussed issues that arise.  
* This page explains visitor pattern in detail from the basics upto implementation using C++ as language. It has implementation details and also have discussed issues that arise. http://www.swe.uni-linz.ac.at/research/deco/designPatterns/visitor/visitor.defaultroles.c++.html


==Visitor Pattern in Python==
==Visitor Pattern in Python==

Revision as of 07:12, 19 November 2012

Visitor Pattern, Directory of sites

The Purpose of this article is to act as a "directory of sites", or a simple quick jump page for the reader. The effort is to try and collect good sources (blog posts, forum chats, general articles etc.) which deal with the Visitor pattern and to make this available to the readers with summary. The readers can then explore the links provided, to understand certain topics that they are interested in. Readers are also encouraged to edit the document in case they are able to contribute good material. Since this is just a quick jump page, there will be an apparent lack of examples. This is in line with the requirements given in the writeup, since we are re-directing you to pages where you will get plenty of information.

Introduction

In Object Oriented Programming, the Visitor Pattern is a way of decoupling algorithms to be performed by an object. The way to do this is to create a visitor class which would help to add new virtual function to the classes without modifying their structures. This is accomplished by creating appropriate specializations of the virtual function in visitor class which will take instance reference as input and implements the algorithm using double dispatch.

For more information on the Visitor pattern, you can visit the following links

This page can provide more introductory information on visitor pattern

Wikipedia provides a good condensed view on the topic of the Visitor pattern.

Motivation

Now that some information is present about what the Visitor pattern is and what it should do, let us explore the motivation behind using the Visitor pattern. Some links are provided for the reader to explore the topic and a brief summary is presented to guide the reader

Motivation for visitor patterns is nicely depicted in Wikipedia for Visitor pattern.

One of the top visited sites for design pattern basics , oodesign.com has good introduction, examples and implementation details. Sample code is also available for the reader. The article is good not only from the point of view of explaining the motivation behind Visitor patterns, but also because it follows a good flow in setting up the topic, explanation using examples and concluding with a brief summary

This page has good detailed description of visitor pattern and the worth reading part is the discussion section of this page which also talks about how double dispatch is related to visitor.

Simple introductory page which describes and talks about the pattern in short. It is a very 'bare-bones' reference article, but is a good introductory piece

Visitor Pattern in Java

(1) http://java.dzone.com/articles/design-patterns-visitor (2) http://www.javaworld.com/javatips/jw-javatip98.html (3) http://snehaprashant.blogspot.com/2009/01/visitor-pattern-in-java.html (4) http://en.wikipedia.org/wiki/Visitor_pattern#Java_example

Visitor Pattern in C++

Following are the links which provides examples based on C++:

This page explains visitor pattern in detail from the basics upto implementation using C++ as language. It has implementation details and also have discussed issues that arise.

Visitor Pattern in Python

Following are two links which provide good examples of implementation of visitor patterns in python:

Visitor Pattern in Ruby

(1) https://gist.github.com/989193 (2) http://www.scribd.com/doc/2217773/Design-Patterns-in-Ruby

Advantages

Disadvantages



Video Lecture: (1) https://www.youtube.com/watch?v=mTJodk3vfdk (2) https://www.youtube.com/watch?v=UYUopyMcWjw&feature=related