VMware Infrastructure 3 Book Excerpt and Author Interview
VMware Infrastructure 3: Advanced Technical Design Guide and Advanced Operations Guide provides a wealth of practical insights into setting up virtualization in todays corporate environments.
Tracking change and innovation in the enterprise software development community
Posted by Ryan Slobojan on May 13, 2008 09:00 PM
Effective Java, Second Edition by Joshua Bloch is an updated version of the classic first edition, which was the winner of a 2001 Jolt Award. This edition has been updated to discuss Java 6 language features, and the back cover of the book describes some of the new topics covered as:
The book's publisher, Addison-Wesley, made an excerpt available to InfoQ which includes the contents of the fifth chapter, entitled 'Generics'.
Read Book Excerpt and Interview: Effective Java, Second Edition
From the article:
InfoQ: Are there major changes between the previous version of 'Effective Java' and this one, or is it more of a refinement of existing ideas?
Joshua Bloch: It's a combination of additions and refinements. The second edition covers all the new language features. It has a chapter on generics, one on enums and annotations, and items on the for-each loop, autoboxing, varargs, and static import. The concurrency chapter has been thoroughly revised in light of java.util.concurrent. And all the existing items have been revised to reflect these new features, and to reflect seven more years of experience with the platform.
That said, I worked very hard not to alter the feel of the book. Hopefully it will feel like an old friend to readers of the first edition -- a little wiser and little heavier (21 items and 83 pages, to be precise), but an old friend.
JProbe Freeware – Eclipse Plugin for efficient memory analysis and diagnosis
Spring App Platform, Java Concurrency/Multicore, Eclipse Mylyn and more @ QCon SF Nov 19-21
IBM software architect eKit: Grady Booch podcast, whitepapers, articles
The Agile Business Analyst: Skills and Techniques needed for Agile
Josh, We all love you and you are the star!!!!! Thanks Prashant
"They also asked us to add the following comment:" which comment were you referring to ? BR, ~A
My apologies - the comment being referred to is now found at the bottom of the article. When it was moved, the line you mentioned was not updated - it has been fixed now.
Thanks for catching that!
I'm very excited about this edition, and it is great to see InfoQ offering the generics chapter so we can take a peek before the book begins to ship. I don't know if this is the version that went to press, but I think there is a small error on a code snippet. On the bottom of page 121 we find:
// Reduction without generics or concurrency flaw
static Object reduce(List list, Function f, Object initVal) {
Object[] snapshot = list.toArray(); // Locks list internally
Object result = initVal;
for (Object o : list)
result = f.apply(result, o);
return result;
}
But I believe the inner loop should have been:
// Reduction without generics or concurrency flaw
static Object reduce(List list, Function f, Object initVal) {
Object[] snapshot = list.toArray(); // Locks list internally
Object result = initVal;
for (Object o : snapshot)
result = f.apply(result, o);
return result;
}
I am not sure I agree with your change entirely since the index of the array is never referenced in your code from within the for-each loop. However, I can see what you mean by the book version being incorrect since snapshot is not used anywhere.
Rafael,
You are absolutely right. What's worse, I caught this problem before the book went to print. I fixed it in the code example bundle (which will soon be posted on the book's web site). Somehow I failed to propagate the change into the book. I hope this is the only place where I did this.
I will fix the problem in the second printing and put it on the (currently nonexistent) errata page as soon as possible.
Thanks for spotting this!
Josh
Josh,
I'm wondering if you have revised Item 7 in the first edition, which contains this statement (in bold no less), which seems to me to be false:
"There is simply no way to extend an instantiable class and add an aspect while preserving the equals contract."
The example in the book missed these possible implementations for Point and ColorPoint respectively, which appear to me to fill the bill:
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (o.getClass() != getClass()) return false;
Point p = (Point) o;
return p.x == x && p.y == y;
}
public boolean equals(Object o) {
if (!super.equals(o)) return false;
ColorPoint p = (ColorPoint) o;
return p.color == color;
}
VMware Infrastructure 3: Advanced Technical Design Guide and Advanced Operations Guide provides a wealth of practical insights into setting up virtualization in todays corporate environments.
Ruby 1.9's Fibers and non-blocking I/O are getting more attention - we talked to Mohammad A. Ali of the NeverBlock project and Tony Arcieri of the Revactor project.
Tim Mackinnon talks about the aspirations behind the Agile principles and practices, the desire to become efficient, to write quality code which does not end up being thrown away.
Brian Goetz discusses the difficulties of creating multithreaded programs correctly, incorrect synchronization, race conditions, deadlock, STM, concurrency, alternatives to threads, Erlang, Scala.
Often the hardest part of changing technologies is language syntax differences. This new article provides Java developers with a transition guide to Actionscript which forms the foundation of Flex.
Neal Ford talks about having multiple languages running on one of the two major platforms: Java and .NET. He also presents the advantages offered by Ruby compared to static languages like Java or C#.
David Anderson talks about the history of Agile, the current status of it and his vision for the future. The role of Agile consists in finding ways to implement its principles.
Nick Sieger talks about the future of JRuby, Java Integration, and his work on JEE deployment tools for Ruby on Rails like Warbler.
7 comments
Reply