[jdom-interest] Common interfaces..

Louis Tribble louis.tribble at webgain.com
Fri May 4 10:49:49 PDT 2001


Elliotte Rusty Harold wrote:
> Perhaps. I've been reading up on Visitor and so far it seems to me 
> like it requires a common interface such as Node rather than 
> replacing it. It doesn't provide tree-traversal capabilities, just 
> gives you a way to add functionality once you already have tree 
> traversal capabilities.

My understanding of Visitor is that its value shows up when you have
a stable set of tree node classes but an open-ended set of operations which
you apply to a tree. It provides a way to add operations without having to 
touch the node classes (particularly valuable when you _cannot_ touch
the node classes, as when you are using a third party API). 

When a new tree node class is added, all the visitors potentially need to be 
changed, so in APIs where the node classes change a lot, visitors are more 
fragile. That would not seem to the case for JDOM.

Louis Tribble




More information about the jdom-interest mailing list