[jdom-interest] XMLOutputter naming questions

Alex Chaffee guru at edamame.stinky.com
Mon Oct 2 13:38:17 PDT 2000

Louis, Rusty -- the method is called "output" because the class is
called "XMLOutputter."  It outputs XML.  If you think "output" has to
change something outside the VM, well, that's a different metaphor
than is in effect here.  Every process in computer science has input
and output; the parameters are the input to a method; and so on.  I
think in this case "output" means org.jdom.output means "classes that
output from the JDOM library" just like org.jdom.input means "input
something into JDOM."

I especially don'g like "toString(Document)" because toString means
"turn the object into a string" but here the object is the
XMLOutputter itself.  'toString(x)' would then by extension mean "turn
the XMLOutputter into a String based on x" which is not what's going
on here.

(XMLOutputter.toString() would return a string with the states of the
properties; overloading should not change the high-level semantics of
a method, just its parameters.)

 - A

On Mon, Oct 02, 2000 at 12:35:46PM -0700, Louis Tribble wrote:
> Alex Chaffee wrote:
> > +1 on outputString, since "get" generally refers to a *property* of
> > the object, and String is not a property.  "outputString" is more
> > descriptive of what it's really doing.
> Ouch.
> outputString() implies to me that output (some state change to the
> external environment) is happening, but it isn't. 
> There is some precedent for calling such methods "to<class>()". If, in 
> this case, toString() is not comfortable (because of its presumptive
> debugging usage), we could fall back to toXMLString(), or some such.
> For myself, toString() seems fine.
> Louis
> -- 
> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
> Louis Tribble                                         louis at metamata.com
> Metamata, Inc.                                   http://www.metamata.com
> Tools for serious Java developers.                       +1 510 796 0915
> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

Alex Chaffee                       mailto:alex at jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/

More information about the jdom-interest mailing list