{ by david linsin }

October 12, 2007

Java Wisdoms

Sun Developer Network posted a great conversation with Heinz Kabutz, a Java Champion. Artima covered parts of the conversation as well.

One technical detail that was quite interesting about the conversation, the part that was posted on Artima, was String optimization by the JVM:
When Strings are added using the + operator, the compiler in J2SE 5.0 and Java SE 6 will automatically use StringBuilder. If StringBuffer is hard-coded, this optimization will not occur.
This is really cool and I have to admit, I didn't know that. I was taught in my very beginnings of Java programming that concating String objects with + operator is a bad thing.

There are other nice comments on Java and programming in general covered in this conversation and it's definitely worth a read. For instance, I like this one on concurrency:
Programmers overuse threads, which leads to problems, and "The Law of the Corrupt Politician," whereby the absence of adequate controls leads to corrupt objects. Programmers typically respond by adding controls everywhere, leading to "The Law of the Micromanager," in which the performance is severely hampered by contention.
It's quite true, I noticed that myself. It's hard to "give up" control and let threads do their thing. You end up trying to figure out the state of your threads. Are they finished? Did any of them fail? But with questions like those you might just want think about if you really wanna go asynchronous.

0 comments:


com_channels

  • mail(dlinsin@gmail.com)
  • jabber(dlinsin@gmail.com)
  • skype(dlinsin)

recent_postings

loading...