Synopses & Reviews
Raves for the First Edition!
“I sure wish I had this book ten years ago. Some might think that I don’t need any Java books, but I need this one.”
–James Gosling, fellow and vice president, Sun Microsystems, Inc.
“An excellent book, crammed with good advice on using the Java programming language and object-oriented programming in general.”
–Gilad Bracha, coauthor of The Java™ Language Specification, Third Edition
“10/10–anyone aspiring to write good Java code that others will appreciate reading and maintaining should be required to own a copy of this book. This is one of those rare books where the information won’t become obsolete with subsequent releases of the JDK library.”
–Peter Tran, bartender, JavaRanch.com
“The best Java book yet written.... Really great; very readable and eminently useful. I can’t say enough good things about this book. At JavaOne 2001, James Gosling said, ‘Go buy this book!’ I’m glad I did, and I couldn’t agree more.”
–Keith Edwards, senior member of research staff, Computer Science Lab at the Palo Alto Research Center (PARC), and author of Core JINI (Prentice Hall, 2000)
“This is a truly excellent book done by the guy who designed several of the better recent Java platform APIs (including the Collections API).”
–James Clark, technical lead of the XML Working Group during the creation of the XML 1.0 Recommendation, editor of the XPath and XSLT Recommendations
“Great content. Analogous to Scott Meyers’ classic Effective C++. If you know the basics of Java, this has to be your next book.”
–Gary K. Evans, OO mentor and consultant, Evanetics, Inc
“Josh Bloch gives great insight into best practices that really can only be discovered after years of study and experience.”
–Mark Mascolino, software engineer
“This is a superb book. It clearly covers many of the language/platform subtleties and trickery you need to learn to become a real Java master.”
–Victor Wiewiorowski, vice president development and code quality manager, ValueCommerce Co., Tokyo, Japan
“I like books that under-promise in their titles and over-deliver in their contents. This book has 57 items of programming advice that are well chosen. Each item reveals a clear, deep grasp of the language. Each one illustrates in simple, practical terms the limits of programming on intuition alone, or taking the most direct path to a solution without fully understanding what the language offers.”
–Michael Ernest, Inkling Research, Inc.
“I don’t find many programming books that make me want to read every page–this is one of them.”
–Matt Tucker, chief technical officer, Jive Software
“Great how-to resource for the experienced developer.”
–John Zukowski, author of numerous Java technology books
“I picked this book up two weeks ago and can safely say I learned more about the Java language in three days of reading than I did in three months of study! An excellent book and a welcome addition to my Java library.”
–Jane Griscti, I/T advisory specialist
Are you looking for a deeper understanding of the Java™ programming language so that you can write code that is clearer, more correct, more robust, and more reusable? Look no further! Effective Java™, Second Edition, brings together seventy-eight indispensable programmer’s rules of thumb: working, best-practice solutions for the programming challenges you encounter every day.
This highly anticipated new edition of the classic, Jolt Award-winning work has been thoroughly updated to cover Java SE 5 and Java SE 6 features introduced since the first edition. Bloch explores new design patterns and language idioms, showing you how to make the most of features ranging from generics to enums, annotations to autoboxing.
Each chapter in the book consists of several “items” presented in the form of a short, standalone essay that provides specific advice, insight into Java platform subtleties, and outstanding code examples. The comprehensive descriptions and explanations for each item illuminate what to do, what not to do, and why.
Highlights include:
- New coverage of generics, enums, annotations, autoboxing, the for-each loop, varargs, concurrency utilities, and much more
- Updated techniques and best practices on classic topics, including objects, classes, libraries, methods, and serialization
- How to avoid the traps and pitfalls of commonly misunderstood subtleties of the language
- Focus on the language and its most fundamental libraries: java.lang, java.util, and, to a lesser extent, java.util.concurrent and java.io
Simply put, Effective Java™, Second Edition, presents the most practical, authoritative guidelines available for writing efficient, well-designed programs.
Review
Raves for the First Edition!
“I sure wish I had this book ten years ago. Some might think that I don’t need any Java books, but I need this one.”
—James Gosling, fellow and vice president, Sun Microsystems, Inc.
“An excellent book, crammed with good advice on using the Java programming language and object-oriented programming in general.”
—Gilad Bracha, coauthor of The Java™ Language Specification, Third Edition
“10/10—anyone aspiring to write good Java code that others will appreciate reading and maintaining should be required to own a copy of this book. This is one of those rare books where the information won’t become obsolete with subsequent releases of the JDK library.”
—Peter Tran, bartender, JavaRanch.com
“The best Java book yet written.... Really great; very readable and eminently useful. I can’t say enough good things about this book. At JavaOne 2001, James Gosling said, ‘Go buy this book!’ I’m glad I did, and I couldn’t agree more.”
—Keith Edwards, senior member of research staff, Computer Science Lab at the Palo Alto Research Center (PARC), and author of Core JINI (Prentice Hall, 2000)
“This is a truly excellent book done by the guy who designed several of the better recent Java platform APIs (including the Collections API).”
—James Clark, technical lead of the XML Working Group during the creation of the XML 1.0 Recommendation, editor of the XPath and XSLT Recommendations
“Great content. Analogous to Scott Meyers’ classic Effective C++. If you know the basics of Java, this has to be your next book.”
—Gary K. Evans, OO mentor and consultant, Evanetics, Inc
“Josh Bloch gives great insight into best practices that really can only be discovered after years of study and experience.”
—Mark Mascolino, software engineer
“This is a superb book. It clearly covers many of the language/platform subtleties and trickery you need to learn to become a real Java master.”
—Victor Wiewiorowski, vice president development and code quality manager, ValueCommerce Co., Tokyo, Japan
“I like books that under-promise in their titles and over-deliver in their contents. This book has 57 items of programming advice that are well chosen. Each item reveals a clear, deep grasp of the language. Each one illustrates in simple, practical terms the limits of programming on intuition alone, or taking the most direct path to a solution without fully understanding what the language offers.”
—Michael Ernest, Inkling Research, Inc.
“I don’t find many programming books that make me want to read every page—this is one of them.”
—Matt Tucker, chief technical officer, Jive Software
“Great how-to resource for the experienced developer.”
—John Zukowski, author of numerous Java technology books
“I picked this book up two weeks ago and can safely say I learned more about the Java language in three days of reading than I did in three months of study! An excellent book and a welcome addition to my Java library.”
—Jane Griscti, I/T advisory specialist
Synopsis
Are you looking for a concise book packed with insight and wisdom not found elsewhere? Need to really understand the Java programming language; that is, really understand it? Do you want to write code that is clear, correct, robust, and reusable? Look no further! The book you are holding will provide you with this and many other benefits you may not even know you were looking for. Become a more effective programmer.
Featuring fifty-seven valuable rules of thumb, Effective Java Programming Language Guide contains working solutions to the programming challenges most developers encounter every day. Offering comprehensive descriptions of techniques used by the experts who developed the Java platform, the book reveals what to do and what not to do in order to produce clear, robust, and efficient code.
Each rule appears in the form of a short, stand-alone essay offering insight, code examples, and "war stories" from this uniquely qualified author. The essays include specific advice and insights into the subtleties of the language and are illustrated with exceptional code examples. Throughout the book, common language idioms and design patterns are examined and insightful and enlightening tips and techniques are provided.
Coverage includes:
- Customary and effective language usage that is saturated with expert advice in a concise, readable, and easy-to-access format.
- Patterns, antipatterns, and idioms to help you get the most out of the Java platform.
- Commonly misunderstood subtleties of the language and its libraries: how to avoid the traps and pitfalls.
- Focus on the language and its most fundamental libraries: java.lang, java.util, and, to a lesser extent, java.io.
- Detailed coverage of serialization, including practical advice that is not available elsewhere.
Appealing to a broad spectrum of the programming community, Effective Java Programming Language Guide presents the most practical, authoritative guidelines available for writing efficient, well-designed programs for the Java platform.
Synopsis
A new edition of this title is available, ISBN-10: 0321356683 ISBN-13: 9780321356680
Synopsis
Are you looking for a deeper understanding of the Java™ programming language so that you can write code that is clearer, more correct, more robust, and more reusable? Look no further! Effective Java™, Second Edition, brings together seventy-eight indispensable programmer’s rules of thumb: working, best-practice solutions for the programming challenges you encounter every day.
This highly anticipated new edition of the classic, Jolt Award-winning work has been thoroughly updated to cover Java SE 5 and Java SE 6 features introduced since the first edition. Bloch explores new design patterns and language idioms, showing you how to make the most of features ranging from generics to enums, annotations to autoboxing.
Each chapter in the book consists of several “items” presented in the form of a short, standalone essay that provides specific advice, insight into Java platform subtleties, and outstanding code examples. The comprehensive descriptions and explanations for each item illuminate what to do, what not to do, and why.
Highlights include:
- New coverage of generics, enums, annotations, autoboxing, the for-each loop, varargs, concurrency utilities, and much more
- Updated techniques and best practices on classic topics, including objects, classes, libraries, methods, and serialization
- How to avoid the traps and pitfalls of commonly misunderstood subtleties of the language
- Focus on the language and its most fundamental libraries: java.lang, java.util, and, to a lesser extent, java.util.concurrent and java.io
Simply put, Effective Java™, Second Edition, presents the most practical, authoritative guidelines available for writing efficient, well-designed programs.
Synopsis
New edition of this book now available
About the Author
Joshua Bloch is a principal engineer at Google and a Jolt Award-winner. He was previously a distinguished engineer at Sun Microsystems and a senior systems designer at Transarc. Josh led the design and implementation of numerous Java platform features, including JDK 5.0 language enhancements and the award-winning Java Collections Framework. He holds a Ph.D. in computer science from Carnegie Mellon University.
Table of Contents
Foreword.
Preface.
Acknowledgements.
1. Introduction.
2. Creating and Destroying Objects.
Consider Providing Static Factory Methods Instead of Constructors.
Enforce the Singleton Property with a Private Constructor.
Enforce Noninstantiability with a Private Constructor.
Avoid Creating Duplicate Objects.
Eliminate Obsolete Object References.
Avoid Finalizers.
3. Methods Common to All Objects.
Obey the General Contract when Overriding Equals.
Always Override HashCode When You Override Equals.
Always Override to String.
Override Clone Judiciously.
Consider Implementing Comparable.
4. Classes and Interfaces.
Minimize the Accessibility of Classes and Members.
Favor Immutability.
Favor Composition Over Inheritance.
Design and Document for Inheritance or Else Prohibit It.
Prefer Interfaces to Abstract Classes.
Use Interfaces Only to Define Types.
Favor Static Member Classes Over Non-Static.
5. Substitutes for C Constructs.
Replace Structures with Classes.
Replace Unions with Class Hierarchies.
Replace Enums with Classes.
Replace Function Pointers with Classes and Interfaces.
6. Methods.
Check Parameters for Validity.
Make Defensive Copies when Needed.
Design Method Signatures Carefully.
Use Overloading Judiciously.
Return Zero-Length Arrays, Not Nulls.
Write Doc Comments for All Exposed API Elements.
7. General Programming.
Minimize the Scope of Local Variables.
Know and Use the Libraries.
Avoid Float and Double if Exact Answers are Required.
Avoid Strings where Other Types are More Appropriate.
Beware the Performance of String Concatenation.
Refer to Objects by their Interfaces.
Prefer Interfaces to Reflection.
Use Native Methods Judiciously.
Optimize Judiciously.
Adhere to Generally Accepted Naming Conventions.
8. Exceptions.
Use Exceptions Only for Exceptional Conditions.
Use Checked Exceptions for Recoverable Conditions, Runtime Exceptions for Programming Errors.
Avoid Unnecessary Use of Checked Exceptions.
Favor the Use of Standard Exceptions.
Throw Exceptions Appropriate to the Abstraction.
Document All Exceptions Thrown by Each Method.
Include Failure-Capture Information in Detail Messages.
Strive for Failure Atomicity.
Don't Ignore Exceptions.
9. Threads.
Synchronize Access to Shared Mutable Data.
Avoid Excessive Synchronization.
Never Invoke Wait Outside a Loop.
Don't Depend on the Thread Scheduler.
Document Thread-Safety.
Avoid Thread Groups.
10. Serialization.
Implement Serializable Judiciously.
Consider Using a Custom Serialized Form.
Write ReadObject Methods Defensively.
Provide a ReadResolve Method when Necessary.
References.
Index.