Factbites
 Where results make sense
About us   |   Why use us?   |   Reviews   |   PR   |   Contact us  

Topic: Visitor pattern


Related Topics

  
  Design Pattern Synopses
The Filter pattern is a special case of the Decorator pattern, where a data source or data sink object is wrapped to add logic to the handling of a data stream.
The Composite pattern also allows the objects in the tree to be manipulated in a consistent manner, by requiring all of the objects in the tree to have a common superclass or interface.
The Visitor pattern is often used with object structures that are organized according to the Composite pattern.
www.mindspring.com /~mgrand/pattern_synopses.htm   (4381 words)

  
 Subject-oriented programming and the visitor pattern
The Visitor pattern is intended to "[define a new] operation to be performed on the elements of an object structure, operation without changing the classes of the elements on which it operates" ["Design Patterns - Elements of Reusable Software" by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides].
The Visitor pattern creates several redundant elements: the visitor object which must be accessed by the node, the access path by which a node finds the visitor object, and the acceptor operation which encodes the node's class in its operation name.
Looking at the way the visitor pattern is structured, as illustrated in the above example, it is clear that the concrete hierarchy of implementation classes is mapped on a one-for-one basis into the set of operations to be implemented by each visitor.
www.research.ibm.com /sop/sopcvisp.htm   (1230 words)

  
 Object Oriented Design and Programming - Software Design Principles and Design Patterns - Visitor Pattern
Visitor pattern allows us to create a separate visitor concrete class for each type of operation and to separate this operation implementation from the objects structure.
The classic implementation of the Visitor pattern have a major drawback because the type of visitor methods has to be known in advance.
Another difference is operation performed on the objects: In one case the visitor defines the operations that should be performed, while the iterator is used by the client to iterate through the objects form a collection and the operations are defined by the client itself.
www.oodesign.com /oo_design_patterns/behavioral_patterns/visitor_pattern.html   (1316 words)

  
 Visitor
An acknowledged objection to the Visitor pattern is that is represents a regression to functional decomposition - separate the algorithms from the data structures.
The Visitor pattern represents an operation to be performed on the elements of an object structure without changing the classes on which it operates.
The Visitor pattern is like a more powerful Command pattern because the visitor may initiate whatever is appropriate for the kind of object it encounters.
home.earthlink.net /~huston2/dp/visitor.html   (1477 words)

  
 ArticleS.UncleBob.IuseVisitor   (Site not responding. Last check: )
The Visitor pattern violates this by forcing the Employee to be aware of **all** the Reports classes that use it.
Te Visitor pattern is simply a kludge necessitated by the limitations of statically typed languages that force one to write unnecessary code and violate other good design principles.
I readily agree that the Visitor pattern is a kludge.
www.butunclebob.com /ArticleS.UncleBob.IuseVisitor   (6903 words)

  
 Visitor pattern considered useless
The visitor pattern is a programming pattern that has been advocated strongly for writing code operating on a hierarchy of classes.
If a visitor pattern has not been written in the first time, the hierarchy has to be modified to implement it.
The Visitor pattern is a trick to introduce multiple dispatch in a language that lacks it.
nice.sourceforge.net /visitor.html   (440 words)

  
 ModelMaker Design Patterns - Delphi / C# design pattern implementation: Wrapper, Visitor, Observer, Adapter, Singleton, ...
Visitor pattern, represents an operation to be performed on the elements of an object structure by a class.
Thus enabling us to support design patterns in a brand new way: as active agents looking over your shoulder while you are editing your model and automatically reflecting changes where ever needed, keeping the pattern's implementation up to date.
Because the pattern is alive, it can reflect changes in the model to the pattern related code or even automatically add or delete members if needed.
www.modelmakertools.com /modelmaker/design-patterns.html   (918 words)

  
 Dr. Dobb's | The Visitor Pattern and a Java Grep Utility | June 1, 1998
The Visitor pattern is a behavioral pattern that enables an enumeration of objects (visitors) to implement operations performed on a subject-object structure, without the subject-object structure having to retain knowledge of a visiting object (Figure 1).
Visitor behavior is exercised with a polymorphic message, passing the subject as an argument (an approach known as "double dispatching").
Visitor objects obtain a reference to the subject object they are "visiting," thus subject-object structure is made available.
www.ddj.com /184410579?pgno=1   (1502 words)

  
 Dr. Dobb's | The Visitor Pattern | June 1, 2001
The Visitor family allows new methods to be added to existing hierarchies without modifying the hierarchies.
A very common use of the Visitor pattern is to walk large data structures and generate reports.
In every case where Visitors are used, the data structure being used is independent of the uses to which it is being put.
www.ddj.com /dept/cpp/184403919?pgno=29   (1864 words)

  
 Alex Miller - design
The Visitor pattern is typically used when you have a multi-object data structure (often something tree-like) and you want to traverse the data structure and implement various algorithms over it.
Visitor is a pattern that pulls these two items out of the data classes and replaces it with visitor-agnostic code in each data class.
Visitor lets you “bake in” the ability to support any number of algorithms over a heterogeneous data structure without modifying the data structure as algorithms are added.
tech.puredanger.com /category/design   (3816 words)

  
 Visitor Design Pattern in C# and VB.NET.
Represent an operation to be performed on the elements of an object structure.
Visitor lets you define a new operation without changing the classes of the elements on which it operates.
That lets the visitor determine the concrete class of the element being visited.
www.dofactory.com /Patterns/PatternVisitor.aspx   (306 words)

  
 Visitor Pattern
With the Visitor pattern, you define two class hierarchies: one for the elements being operated on (the Node hierarchy) and one for the visitors that define operations on the elements (the NodeVisitor hierarchy).
So the key consideration in applying the Visitor pattern is whether you are mostly likely to change the algorithm applied over an object structure or the classes of objects that make up the structure.
Without a visitor, this state would be passed as extra arguments to the operations that perform the traversal, or they might appear as global variables.
www.swe.uni-linz.ac.at /research/deco/designPatterns/Visitor/Visitor.abstract.html   (1357 words)

  
 Visitor Pattern
Visitor is in fact a "double dispatch" technique that could be used on a single object as well as a collection.
Visitor is easier to illustrate in code than it is to describe.
The visitor pattern has a feel similar to a SAXParser parser for XML in that the framework calls my visitor with various events as it works its way through the model.
www.surfscranton.com /architecture/VisitorPattern.htm   (763 words)

  
 The Visitor Design Pattern
The purpose of the Visitor Pattern is to encapsulate an operation that you want to perform on the elements of a data structure.
Using a Visitor pattern allows you to decouple the classes for the data structure and the algorithms used upon them.
The body of this method shows the double dispatching call, where the Visitor is passed in to the accept method, and that visitor is told to execute its visit method, and is handed the node by the node itself.
www.exciton.cs.rice.edu /JavaResources/DesignPatterns/VisitorPattern.htm   (531 words)

  
 Applying the Visitor pattern using reflection   (Site not responding. Last check: )
The Visitor pattern, as defined in Design Patterns, is great if you're acting on a structure of objects in several different ways, and it makes it easy to change between the actions that you're performing on each, without having to resort to instanceof's or changing the code of the objects you act upon.
A limitation to the standard implementation of the pattern is that it's not suitable when the classes defining the structure itself are frequently changing, rather than the actions to be applied to them.
So, the standard Visitor is very useful when you want to perform a number of different operations on one static set of objects, but if the types of objects that you want to act on is changing, it's not so useful.
www.surguy.net /articles/visitor-with-reflection.xml   (540 words)

  
 Visitor Pattern
The essence of the visitor pattern is not particularly easy to abstract from the example C++ code shown in Figures 11 and 13.
The visitor defines the task-specific meaning of the before and after methods that are executed during the traversal of a composite object.
Unlike the state and strategy patterns, where a context was attached to a specific object, the visitor pattern attaches a context to a traversal.
www.ccs.neu.edu /research/demeter/papers/context-journal/node9.html   (1479 words)

  
 The Life of Riley - Software - Visitor Pattern
Some patterns in the book, such as Strategy and Adapter, are so intuitive that a programmer who merely hears the name can guess what the pattern entails.
Visitor is not like these other patterns: it takes a good amount of thinking to understand it, and it's use is limited to very specific cases.
Being a pattern that has limited applicability and, on top of that, is difficult to understand initially, Visitor may be the unwitting subject of such learning behavior more often than other patterns.
rileywhite.com /software/visitorpattern.html   (1175 words)

  
 Selective Visitor   (Site not responding. Last check: )
During usage, a Visitor visits each element in the structure via recursive descent (if the elements are contained in a Composite structure), or via iteration (over the elements of a Collection), or via a combination of both (if the visited elements are both composed and collected).
Without a Visitor, accumulated state would have to be passed as extra arguments to the structure traversal operations, or else cached in some accessible global object(s).
The Selective Visitor pattern relies on the ability to derive a class from multiple classification abstractions, whether such classifications are implemented using abstract base classes or (ideally) as declared types.
www.educery.com /papers/patterns/visitors/selective.visitor.html   (1507 words)

  
 eXtensible Mind Lounge : Visitor Design Pattern: revisited for .NET
The Visitor pattern allows the developer to define new operations on the elements without changing their interface.
This behavior is called a Double-Dispath pattern, because the method being executed at last depends both on the caller's type (the visitor) and the element's type (the visitable element).
As this is a very subtle mistake of the concrete visitor developer, we decided to prevent this from happening, even when the right solution is to remove the wrong call to the base class method.
weblogs.asp.net /cazzu/articles/25488.aspx   (1745 words)

  
 Visitor Design Pattern   (Site not responding. Last check: )
This Visitor pattern is based on the Visitor pattern as described in [Gam+, pages 331..344].
Visitor lets you define a new operation without changing the classes of the elements on which it operates’ [Gam+, page 331].
With the Visitor pattern, you define two class hierarchies: one for the elements being operated on (the TMember hierarchy) and one for the visitors that define operations on the elements (the TMemberVisitor hierarchy).
www.castle-cadenza.demon.co.uk /visitor.htm   (893 words)

  
 Visitor Pattern (Behavioral)
Visitor lets you define a new operation without changing the classes of the elements on which it operates.
Visitor lets you keep related operations together by defining them in one class.
Changing the object structure classes requires redefining the interface to all visitors, which is potentially costly.
www.evl.uic.edu /park/Visitor/Visitor.html   (394 words)

  
 1.1.11.1 Double Dispatch and the ``Visitor'' Pattern
Double dispatch and the ``Visitor'' pattern are mechanisms for selecting a method to be executed, based on the type of two objects at the same time.
The ``Visitor'' pattern is a specialized form of double dispatch, used to apply an algorithm to a structured collection of objects.
The object adaptation approach to this, is to define visitor(s) as adapters from the objects being traversed, to an interface that supplies the desired behavior.
peak.telecommunity.com /protocol_ref/dispatch-example.html   (974 words)

  
 CIOL : Languages & Tools : Visitor Pattern   (Site not responding. Last check: )
The Visitor Pattern provides an alternative way to implement operations that avoid complicating the classes of the objects in the structure by putting all of the necessary logic in a separate visitor class.
Notice that there is no indication what the Visitor does with teachclass in either the client classes or the abstract Visitor class.
This is the key to the Visitor pattern: The operation that gets executed depends on both the type of Visitor and the type of Element it visits.
www.ciol.com /content/search/showarticle1.asp?artid=29352   (814 words)

  
 Deriving the Visitor Pattern: A Review and Discussion @ JAVA DEVELOPER'S JOURNAL   (Site not responding. Last check: )
The visitor pattern is classified as a Behavioral pattern, so the thing to notice is the way in which the classes and objects interact and distribute responsibility.
The visitor pattern is a way of separating the operation from the object structure and a way of collecting together the different implementations of an operation for different kinds of elements in the object structure.
The visitor is passed to each element in the structure in turn, by calling its accept() method and the Visitor then performs the operation on the visited element.
java.sys-con.com /read/140105.htm   (1741 words)

  
 jGuru: Visitor pattern
It is a pattern to separate out the "members" of a place from the "visitors" to the place.
The visitor pattern alleviates this pain, by putting such non-fundamental operations in a single place outside the class hierarchy.
Also note that the visitor pattern is a good fit only if the the class hierarchy itself is stable.
jguru.com /forums/view.jsp?EID=386735   (457 words)

  
 1.12 The Visitor Pattern   (Site not responding. Last check: )
Moreover, we cannot use these patterns to define new operations if we do not control the source code for the composite class.
In this section, we introduce a design pattern, called the visitor pattern, that completely and elegantly solves the problem of adding new operations to composite class hierarchies without modifying the text of either the composite class or its variants.
Before delving into the technical definition of the visitor pattern, we present a motivating example: an interpreter for arithmetic expressions.
www.cs.rice.edu /~cork/newBook/node62.html   (170 words)

  
 Using Reflection for the Visitor Pattern - .NET Developers   (Site not responding. Last check: )
Design Patterns is perhaps the book that's had the single greatest influence on my development career.
The visitor pattern allows you to define new, polymorphic operations on a class structure, without touching the source code for the classes themselves.
We need this because not every visitor is going to be interested in every single class; sometimes, you might only be interested in a few of the dozens (or perhaps even hundreds) of potential classes.
www.dotnetdevs.com /articles/ReflectionVisitor.aspx   (1496 words)

  
 VisitorRevisited - The PEAK Developers' Center
A variation on the Visitor pattern, called "Extrinsic Visitor", is more commonly used in Python.
Lisp developers have been occasionally known to sneer at the Visitor pattern as a non-solution to a non-problem.
In addition to being useful for implementing "visitors", generic functions are a boon to any module or framework that needs to provide a facility that's open to extension, without requiring modifications to the original code.
peak.telecommunity.com /DevCenter/VisitorRevisited   (1606 words)

Try your search on: Qwika (all wikis)

Factbites
  About us   |   Why use us?   |   Reviews   |   Press   |   Contact us  
Copyright © 2005-2007 www.factbites.com Usage implies agreement with terms.