did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780201310054

Effective Java¿ Programming Language Guide

by
  • ISBN13:

    9780201310054

  • ISBN10:

    0201310058

  • Edition: 1st
  • Format: Paperback
  • Copyright: 2001-01-01
  • Publisher: Prentice Hall
  • View Upgraded Edition

Note: Supplemental materials are not guaranteed with Rental or Used book purchases.

Purchase Benefits

  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $54.99 Save up to $13.75
  • Buy Used
    $41.24
    Add to Cart Free Shipping Icon Free Shipping

    USUALLY SHIPS IN 2-4 BUSINESS DAYS

Supplemental Materials

What is included with this book?

Summary

"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 sincethe 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, stand alone 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."--BOOK JACKET.

Table of Contents

Foreword xi
Preface xiii
Acknowledgments xv
Introduction
1(4)
Creating and Destroying Objects
5(20)
Consider providing static factory methods instead of constructors
5(5)
Enforce the singleton property with a private constructor
10(2)
Enforce noninstantiability with a private constructor
12(1)
Avoid creating duplicate objects
13(4)
Eliminate obsolete object references
17(3)
Avoid finalizers
20(5)
Methods Common to All Objects
25(34)
Obey the general contract when overriding equals
25(11)
Always override hashCode when you override equals
36(6)
Always override to String
42(3)
Override clone judiciously
45(8)
Consider implementing Comparable
53(6)
Classes and Interfaces
59(38)
Minimize the accessibility of classes and members
59(4)
Favor immutability
63(8)
Favor composition over inheritance
71(7)
Design and document for inheritance or else prohibit it
78(6)
Prefer interfaces to abstract classes
84(5)
Use interfaces only to define types
89(2)
Favor static member classes over nonstatic
91(6)
Substitutes for C Constructs
97(22)
Replace structures with classes
97(3)
Replace unions with class hierarchies
100(4)
Replace enum constructs with classes
104(11)
Replace function pointers with classes and interfaces
115(4)
Methods
119(22)
Check parameters for validity
119(3)
Make defensive copies when needed
122(4)
Design method signatures carefully
126(2)
Use overloading judiciously
128(6)
Return zero-length arrays, not nulls
134(2)
Write doc comments for all exposed API elements
136(5)
General Programming
141(28)
Minimize the scope of local variables
141(4)
Know and use the libraries
145(4)
Avoid float and double if exact answers are required
149(3)
Avoid strings where other types are more appropriate
152(3)
Beware the performance of string concatenation
155(1)
Refer to objects by their interfaces
156(2)
Prefer interfaces to reflection
158(3)
Use native methods judiciously
161(1)
Optimize judiciously
162(3)
Adhere to generally accepted naming conventions
165(4)
Exceptions
169(20)
Use exceptions only for exceptional conditions
169(3)
Use checked exceptions for recoverable conditions and run-time exceptions for programming errors
172(2)
Avoid unnecessary use of checked exceptions
174(2)
Favor the use of standard exceptions
176(2)
Throw exceptions appropriate to the abstraction
178(3)
Document all exceptions thrown by each method
181(2)
Include failure-capture information in detail messages
183(2)
Strive for failure atomicity
185(2)
Don't ignore exceptions
187(2)
Threads
189(24)
Synchronize access to shared mutable data
189(7)
Avoid excessive synchronization
196(5)
Never invoke wait outside a loop
201(3)
Don't depend on the thread scheduler
204(4)
Document thread safety
208(3)
Avoid thread groups
211(2)
Serialization
213(20)
Implement Serializable judiciously
213(5)
Consider using a custom serialized form
218(6)
Write readObject methods defensively
224(6)
Provide a readResolve method when necessary
230(3)
References 233(6)
Index of Patterns and Idioms 239(2)
Index 241

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Excerpts

In 1996 I pulled up stakes and headed west to work for JavaSoft, as it was then known, because it was clear that was where the action was. In the intervening five years I've served as Java Platform Libraries Architect. I've designed, implemented and maintained many of the libraries, and served as a consultant for many others. Presiding over these libraries as the Java platform matured was a once-in-a-lifetime opportunity. It is no exaggeration to say that I had the privilege to work with some of the great software engineers of our generation. In the process, I learned a lot about the Java programming language--what works, what doesn't, and how to use the language and its libraries to best effect. This book is my attempt to share my experience with you, so that you can imitate my successes while avoiding my failures. I borrowed the format from Scott Meyers's Effective C++ Meyers98, which consists of fifty items, each conveying one specific rule for improving your programs and designs. I found the format to be singularly effective and I hope you do too. In many cases, I took the liberty of illustrating the items with real-world examples from the Java platform libraries. When describing something that could have been done better, I tried to pick on code that I wrote myself, but occasionally I pick on something written by a colleague. I sincerely apologize if, despite my best efforts, I've offended anyone. Negative examples are cited not to cast blame but in the spirit of cooperation, so that all of us can benefit from the experience of those who've gone before. While this book is not targeted solely at developers of reusable components, it is inevitably colored by my experience writing such components over the past two decades. I naturally think in terms of exported APIs (Application Programming Interfaces) and I encourage you to do likewise. Even if you aren't developing reusable components, thinking in these terms tends to improve the quality of the software you write. Furthermore, it's not uncommon to write a reusable component without knowing it: you write something useful, share it with your buddy across the hall, and before long you have half a dozen users. At this point, you no longer have the flexibility to change the API at will, and are thankful for all the effort that you put into designing the API when you first wrote the software. My focus on API design may seem a bit unnatural to devotees of the new lightweight software development methodologies, such as Extreme Programming Explained Beck99. These methodologies emphasize writing the simplest program that could possibly work. If you're using one of these methodologies you'll find that a focus on API design serves you well in the refactoring process. The fundamental goals of refactoring are the improvement of system structure and the avoidance of code duplication. These goals are impossible to achieve in the absence of well-designed APIs for the components of the system. No language is perfect, but some of them are excellent. I have found the Java programming language and its libraries to be immensely conducive to quality and productivity, and a joy to work with. I hope this book captures my enthusiasm and helps make your use of the language more effective and enjoyable. Josh Bloch Cupertino, California April, 2001 0201310058P04232001

Rewards Program