Joe Gregoriio asks:

>  Why would the virtual functions have to be at the DOM_* level?
>The DOM_* classes are just handle classes now so wouldn't it be
>possible to create an AbstractNodeImpl with all pure virtual
>functions and then derive XercesNodeImpl from that? Other
>implementations could then be added by creating, for example,
>JoeNodeImpl.
>  If you did this for all the *Impl classes then you would just
>need a mechanism to choose which DocumentImpl to load at runtime.
>  This would require some large changes to the current code base. For
>example, NodeImpl currently holds a DocumentImpl *. This would have
>to be changed to a DOM_Document or AbstractDocumentImpl.
>

This is a reasonable direction to go, and things are even headed
that way, with some of the folks at Lotus looking at a NodeImpl
subclass that defers fully loading their document.

Going this way is not completely clean either, though.  The Impl
classes (interfaces) now need to be relatively public,
at least to anyone doing a subclass, and the subclass implementers
really do need to understand the details of how the smart
pointers and reference counting work.  Bugs in this are
can indeed be painful to track down.

I do think that it's a reasonable thing to consider.

  -- Andy



Reply via email to