[jdom-interest] Ampersand question

Alex Chaffee guru at edamame.stinky.com
Thu Jul 13 03:11:07 PDT 2000

> > Any thoughts on my suggestion to remove getSerializedForm()
> > altogether?  This would force people to use an XMLOutputter, with
> > well-defined behavior, or roll their own.  Furthermore it would
> > improve the separation between data and view.  "Serialized form" is a
> > view and has no real business being in the data object.

> Hi Alex,
> I'm sure you're right architecturally.  I think we should keep
> 'getSerializedForm' just for debugging, and (additionally) putting it in
> separate debugging interface(s) would probably be cleaner.

I disapprove of this use of the API.  It's trivial to write a debug
method that takes an Element and returns a string using (my
hypothetical) XMLOutputter, so you can just say
System.out.println(debug(e)) rather than
 -- my way's even fewer keystrokes :-)

If a method is in the public API, it will be used, and abused, and
required to be supported, and assumed to be valid for all sorts of
things other than debugging.

(Unrealistic aside: By the same reasoning, I object to the toString()
method too; if it were called toDebugString() I'd have no problem
whatsoever.  But too many people use x.toString() to show the *user*
what an x is, which leads to all sorts of UI problems.  The Swing
default list/table views are a good example of this bad style.)

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