[jdom-interest] detach() [eg]

Noam Tamim noamt at yahoo.com
Tue May 1 17:03:45 PDT 2001


As an alternative, how about a simple Element.moveTo(Element) and
Element.moveTo(Document) ?

 - Noam.



----- Original Message -----
From: "Elliotte Rusty Harold" <elharo at metalab.unc.edu>
To: <jdom-interest at jdom.org>
Sent: Monday, April 30, 2001 16:07
Subject: Re: [jdom-interest] detach() [eg]


> At 6:00 PM -0700 4/29/01, Jason Hunter wrote:
> >>  That's secondary to me at this point. I am
> >>  saying, though, that I think detach() on an Element would make me
think it
> >>  detaches an element from the object detach() is being invoked on.
> >
> >Luckily detach() takes no parameters so if that's your inclination (note
> >it's not my inclination) then you'll have to realize it doesn't work
> >that way.
> >
>
> I think Brett's correct here. The way I explain it to my students is that
> the customary order in OOP is
>
> subject.verb(object)
>
> element.detach() violates that common understanding, especially since
> detach is not a reflexive verb.
>
> I really see no need for detach() anymore. I think that
> parent.removeContent(child) is all that's necessary; and detach() as
> currently written is just plain confusing. If we absolutely must have
> that bit of syntax sugar, then the name should be changed to a verb
> that does commonly operate on it's subject, like element.breakAway()
> or some such; but I really don't think we need it.
>
> And of course removing detach() totally eliminates the problems of
> clients unintentionally detaching the root element of a document.
> --
>
> +-----------------------+------------------------+-------------------+
> | Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
> +-----------------------+------------------------+-------------------+
> |                  The XML Bible (IDG Books, 1999)                   |
> |              http://metalab.unc.edu/xml/books/bible/               |
> |   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
> +----------------------------------+---------------------------------+
> |  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
> |  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
> +----------------------------------+---------------------------------+
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com




More information about the jdom-interest mailing list