Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] LeafNode to be deleted?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: Nils_Kilden-Pedersen AT Countrywide.Com
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] LeafNode to be deleted?
  • Date: Wed, 11 Feb 2004 13:06:47 -0500

At 9:59 AM -0800 2/11/04, Nils_Kilden-Pedersen AT Countrywide.Com wrote:
Now you've got me confused. LeafNode saves code duplication AND fits your
abstraction perfectly.
The semantics make sense, so why delete it? To save a class?


I'd like to save the class certainly. The fewer public classes the better.

I can't see where someone is really going to use LeafNode as such given that:

1. Not all children of ParentNodes are LeafNodes
2. Not all LeafNodes are legal children of an element

At one point, LeafNode did have a little more meaning but over time it's been whittled down to just two very simple methods. It makes the inheritance hierarchy a little deeper and less clear than it should be.

As far as saving code duplication, the two methods it keeps are one-liners. One always returns 0 and the other always throws an exception. If I really want to avoid that duplication I could make it a package-protected class which is called by delegation rather than inheritance.
--

Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA




Archive powered by MHonArc 2.6.24.

Top of Page