W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2001

Re: Type-safe iteration over the DOM in DOM 2 & 3?

From: James Melton <james.melton@cylogix.com>
Date: Tue, 20 Mar 2001 16:46:49 -0500
Message-ID: <3AB7CFC9.D9A48D3D@cylogix.com>
To: www-dom@w3.org
Sorry if I misunderstand but... 

It seems that the Visitor pattern makes it "easy" to vary operations
performed on a set of types at the expense of making it "difficult" to
add new types to the set. If you want to extend the Node interface to
many subtypes, isn't Visitor the opposite of what you need? 

Another possibility is that you intend to create a large (but stable)
set of Node subtypes and then flexibly write operations against the
extended hierarchy. This could be a good way to use the Visitor pattern,
but the Visitor interface includes methods like:
VisitConcreteElementA(ConcreteElementA);  which requires the Visitor
interface to know all ConcreteSubtypes on which it can act when it is
written. If that interface is included in the DOM, doesn't it preclude
client code adding new Node subtypes that can be "Visited"?


James Melton                 CyLogix
609.750.5190                 609.750.5100
james.melton@cylogix.com     www.cylogix.com
Received on Tuesday, 20 March 2001 16:44:24 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:08 UTC