[jdom-interest] getChildren() vs getElements()

Jason Hunter jhunter at collab.net
Fri Sep 15 11:56:22 PDT 2000


> Here I can agree with getChildElements() because we are 
> still consistent with the name getChild() which returns a 
> (strongly typed) Element wheras getChildren() returns a List 
> of Objects and only the docs can tell you what to expect.

The proposal isn't:

getChildElements()
getChild()

The proposal is:

getChildElements()
getChildElement()

The former wouldn't be consistent.  One problem with the latter is it's
almost *too* consistent and hard to differentiate.  It's one reason I
prefer getChild() / getChildren().  I also prefer it because it leaves
the option to have getChildTextTrim() which I find really useful.  If we
go with getChildElement() then it'd be getChildElementTextTrim() and
that's just too many nouns to be understandable.

-jh-



More information about the jdom-interest mailing list