[jdom-interest] insertChild in Element

David W. Smiley dsmiley at mitre.org
Thu Aug 31 07:01:32 PDT 2000


I totally agree with what Tom Jenkins said:

> I don't think Element should implement List.  To my mental model,
> Element ->
> List is not an "is-a" relation, but rather a "has-a".
> 
> The line:
>         element.getChildren().add(newElement, 3);
> makes perfect sense. But the alternative line:
>         element.add(newElement, 3);
> just doesn't feel right.

	Also, I don't think JDOM should have both getChildren and be the list
itself.  This means there are two ways to do the same thing which I
think should be avoided in an API.  It's not like we have to support
backwards-compatible JDOM clients as JDOM isn't yet v1.0.

-- David Smiley




More information about the jdom-interest mailing list