Effective Java Programming Language Guide / Edition 1

Effective Java Programming Language Guide / Edition 1

4.0 3
by Joshua Bloch, Josh Bloch

ISBN-10: 0201310058

ISBN-13: 9780201310054

Pub. Date: 06/28/2001

Publisher: Prentice Hall

A new edition of this title is available, ISBN-10: 0321356683 ISBN-13: 9780321356680  See more details below


A new edition of this title is available, ISBN-10: 0321356683 ISBN-13: 9780321356680

Product Details

Prentice Hall
Publication date:
Java Series
Edition description:
Older Edition
Product dimensions:
7.25(w) x 9.08(h) x 0.68(d)

Table of Contents




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.



Read More

Customer Reviews

Average Review:

Write a Review

and post it to your social network


Most Helpful Customer Reviews

See all customer reviews >

Effective Java Programming Language Guide 4 out of 5 based on 0 ratings. 3 reviews.
Guest More than 1 year ago
This doesn't spend much time on my bookshelf because I keep paging through it. I have to disagree with the review by 'JB.' Because Java and C++ (and Perl for that matter, for which there is also an 'Effective' title) are very different languages, it's a bit unreasonable to expect these books to be identical in presentation. That there is less actual code in the Java title illustrates Java's strength in abstraction rather than a shortcoming in book content. Joshua's book is very effective in communicating best practices, just as the C++ and Perl titles do (all from the same publisher). This book lives up to its title.
Guest More than 1 year ago
Great book. I found it to be very useful. A must read for any mature Java developer. I liked the fact that the author often uses actual Java language classes to illustrate his examples. This gave me better appreciation and understanding of the internals of the core Java classes.
Guest More than 1 year ago
Nothing close to 'Effective C++' ( as title might suggest to those familiar). This doesn't imply, that the author doesn't know the subject: but the book isn't good. Wordy. Little code. Not worth a place on your shelf. Hope there won't be 'More effective Java'.