[jdom-interest] Anyone using what's in CVS?

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Feb 4 16:00:30 PST 2004


At 12:14 AM +0100 2/5/04, Robin Rosenberg wrote:

>  public Element createXml() {
>    return createXmlBase().addContent(_ruleName.toString());
>  }
>
>now becomes
>
>  public Element createXml() {
>     Element ret=createXmlBase();
>     ret.addContent(_ruleName.toString());
>     return ret;
>  }


I'm on the record as preferring the latter form. I think it's 
clearer, more obvious, and more in keeping weith Java conventions. 
That's nothing new. But I did recently discover another reason to 
prefer the second form:

It's much easier to debug. It's much more conducive to single 
stepping through code and inspecting the values of variables. Lately 
I've found myself breaking apart a lot of code that tries to cram 
multiple operations onto a single line so I can aim the debugger at 
the right place.
-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA



More information about the jdom-interest mailing list