Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29422 > unrolled thread

A good article on java.lang.String best practices

Started byim.manoj.tripathi@gmail.com
First post2014-07-28 20:50 -0700
Last post2014-07-29 10:24 -0500
Articles 3 — 3 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  A good article on java.lang.String best practices im.manoj.tripathi@gmail.com - 2014-07-28 20:50 -0700
    Re: A good article on java.lang.String best practices Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-29 08:21 -0400
    Re: A good article on java.lang.String best practices Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-07-29 10:24 -0500

#29422 — A good article on java.lang.String best practices

Fromim.manoj.tripathi@gmail.com
Date2014-07-28 20:50 -0700
SubjectA good article on java.lang.String best practices
Message-ID<f645ce00-9672-4c28-b599-3519b5ded480@googlegroups.com>
Here is good article on Strings in Java, of you are a Java developer then this article could be helpful to write good and optimized code.

http://www.groupkt.com/post/5bcd8475/javalangstring-tips-and-tricks:-best-java-
coding-practices.htm

[toc] | [next] | [standalone]


#29425

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2014-07-29 08:21 -0400
Message-ID<lr83jf$q51$1@dont-email.me>
In reply to#29422
On 7/28/2014 11:50 PM, im.manoj.tripathi@gmail.com wrote:
> Here is good article on Strings in Java, of you are a Java developer then this article could be helpful to write good and optimized code.
>
> http://www.groupkt.com/post/5bcd8475/javalangstring-tips-and-tricks:-best-java-
> coding-practices.htm

     Did you write the article yourself?  That would explain the "good"
rating you give it ...

     I'd call it "good" in part, but mostly a rehash of well-known stuff.
The micro-benchmarks, I think, do not merit "good;" they do not inspire
much faith at all.

-- 
esosman@comcast-dot-net.invalid

[toc] | [prev] | [next] | [standalone]


#29428

FromJoshua Cranmer 🐧 <Pidgeot18@verizon.invalid>
Date2014-07-29 10:24 -0500
Message-ID<lr8eba$88s$1@dont-email.me>
In reply to#29422
On 7/28/2014 10:50 PM, im.manoj.tripathi@gmail.com wrote:
> Here is good article on Strings in Java, of you are a Java developer
> then this article could be helpful to write good and optimized code.
>
> http://www.groupkt.com/post/5bcd8475/javalangstring-tips-and-tricks:-best-java-
>  coding-practices.htm

On point 1: Your discussion of when == works is wrong, completely
ignoring interning or reference equality.

Points 2 and 4 both lack an explanation as to one variant might be 
faster, and perhaps reasons why that one may be slower.

Point 5 contradicts its own pithy title.

Point 7 says "we saved multiple string concatenations." Gee, what do you 
think String::format does internally?

Point 8 is so devoid of content to be useless. (Would it really hurt, 
to, I don't know, give examples of utilities, or link to documentation 
in the first place?)

Microbenchmarks are difficult to write properly in the best of 
conditions, and even the best performance experts would hesitate to 
write one. The vibe I get from the post is that so little effort was put 
into establishing a reasonable microbenchmark that the information 
content contained within is worse than useless.

And there's grammar mistakes up the wazoo (sentences should start with
capitals; "their" is the third-person plural possessive pronoun, not
"there"; several sentences are missing connectives; "flyweight" is a 
single word, not two words).

-- 
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web