- Title: Java 2 Performance and Idiom Guide
- Author: Craig Larman, Rhett Guthrie
- Released: 1999-09-16
- Pages: 299
- ISBN: 0130142603
- ISBN13: 978-0130142603
- ASIN: 0130142603
The most notable thing about this book is that it provides a real-world perspective on what does and doesn't work for optimizing Java. (The authors' advice is sometimes counterintuitive, and as Java compilers and environments have improved, outguessing the compiler has become a tricky business.) This book is organized into sections based on the likely effect of the suggested optimizations (from "major-moderate" to "minor" improvements). The authors test their code (and provide benchmark numbers) to back up what they say.
Advice on limiting object creation and remote calls, as well as proper class design for custom classes (especially the implementation custom equals() methods and using object factories) are absolutely invaluable here. The authors also look at how to choose the correct Java 2 collection class for your needs. Included in the discussion are several software patterns and "idioms" (language-specific tips), which can lead to more efficient and reusable designs. With a section on naming conventions, this book also promotes good programming style as well as more efficient code.
As a grab bag of hints for writing better code, the Java 2 Performance and Idiom Guide offers something for almost any Java developer. It demonstrates the authors' considerable experience in real-world projects to show some workarounds for problems that you will sometimes encounter when putting Java into the field for the first time, as well as some leading-edge thinking about efficient class design. --Richard Dragan
Topics covered: Java performance and optimization overview; hardware and memory performance hints; Sun HotSpot JVM; server-side performance issues; optimization hints for algorithms, collections, strings, and object creation; patterns; idioms for designing custom classes; dynamic classloading; constructors and object factories; concurrency hints; resource bundling and internationalization tips; exceptions; interfaces; inner classes and constructors; packaging; testing hints (white-box and unit testing); Java naming conventions; and Java coding style.
From the Back Cover
Thank you for considering the Java 2 Performance and Idiom Guide. The goal of this book is to document the common idioms and optimization techniques that experienced Java developers should know. The topics are presented specifically for Java 2, including coverage of features such as the Collections Framework and the HotSpot JVM.
High Performance Java-write fast code
Our goal is to help catapult the beginner or intermediate Java developer over the chasm of performance pitfalls the Java platform challenges us with. Thus, the book includes a broad introduction to optimizing for speed and space, including:
- Design level optimization principles
- Environment and tool strategies
- Algorithm and data structure strategies
- Language and library specific optimization techniques.
Idioms in Java-write code fast
There are a wide variety of "tricks of the Java trade" or idioms that experienced Java developers apply to develop solid code. Like design patterns, coding idioms provide out-of-the-box solutions for many problems. Unlike design patterns, these idioms are very close to code and therefore take maximum advantage of the Java language and libraries. They include:
- Idiomatic usage of particular JDK classes and APIs, such as the Reflection API.
- Concurrency idioms to create thread-safe code
- Packaging and application structure idioms
- Naming and coding style idioms