Re: PostgreSQL 8.0 Feature List? - Mailing list pgsql-general

From Chris Smith
Subject Re: PostgreSQL 8.0 Feature List?
Date
Msg-id 01e201c48265$77866260$6f00000a@KYA
Whole thread Raw
In response to Re: PostgreSQL 8.0 Feature List?  (sector119@mail.ru)
List pgsql-general
Richard Welty wrote:
> nowhere do these books ever mention StringBuffer. now java
> programmers who have developed a sufficient clue set know that
> String is hopelessly inefficient and will instead write the much
> preferable:

This is an unfortunate example of an over-simplification that is likely to
mislead people greatly.  For a more or less complete discussion of this topic
(demonstrating that the "dumb book" code is actually better than Richard's
alternative) see Jon Skeet's article at
http://www.yoda.arachsys.com/java/strings.html.

> i kind of like _Practical Java_ (Peter Haggar, Addison Wesley)
> for its coverage of these details,

Peter Haggar's book is a fair one, and one I'd cautiously consider if Joshua
Bloch hadn't written his much better book; but Haggar makes it a little too
easy to misunderstand if you don't read closely.  I'm looking at Peter's book
now.  In Praxis 31 where this issue is discussed, Peter Haggar writes some
very poor code using the String concatenation operator in order to make it
slower in a case where it really isn't substantially different at all.  He
doesn't mention that the inefficiency of his code arises from things unrelated
to string concatenation.  He doesn't mention that if he'd written more obvious
code it would be faster than anything he could write with StringBuffer.  I'd
far rather he provided an honest example that demonstrates the real problem,
as Jon does in the article above.

In many other places as well, Peter's sections often give very bad advice, or
only make sense when qualified by the comments in the text, making it very
dangerous to browse advice from the table of comments.  For example, see
Praxis 7, 10, 19, 22, 25, 29, 30, 40, 44, and 45.  The book also is riddled
throughout with the false premise that one can evaluate the efficiency of code
by looking at generated bytecode.  Basically, I'd recommend great caution in
reading it, and independent confirmation of anything that seems surprising.
Or just get Josh Bloch's book instead, which covers the same ground and is far
more trustworthy.

Anyway, yes you can do Java poorly, but it's become fashionable to say so
lately and a lot of people are sure they know exactly how this poor code is
written and are willing to tell you so without actually knowing a thing.  So
just be careful about that.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation


pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: Password authentication
Next
From: Richard Welty
Date:
Subject: understanding your tools