
Effective java programming language guide
Foreword by guy stelle
Résumé
Josh Bloch identifies 50 practices that lead directly to better code -- including better alternatives for common practices that have proven undesirable in real-world development. The techniques are specific, thoroughly explained, and supported by top-notch code examples. Among the highlights: why developers should avoid finalizers; when to use delegation instead of inheritance; and how to make the most of Java's powerful typesafe enum pattern. Nearly all 50 practices relate to the "core" of the Java platform -- the language itself -- making the book relevant to virtually every Java developer.
For all experienced Java programmers, and for C++ programmers who want to maximize their Java expertise and productivity as quickly as possible.
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 toString
- 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
L'auteur - Joshua Bloch
Joshua Bloch is a Principal Engineer at Google. Previously he was a Distinguished Engineer at Sun Microsystems and a Senior Systems Designer at Transarc. He led the design and implementation of numerous Java platform features, including the JDK 5.0 language enhancements and the Java Collections Framework. He holds a Ph.D. in Computer Science from Carnegie-Mellon University and a B.S. in Computer Science from Columbia University.
Caractéristiques techniques
PAPIER | |
Éditeur(s) | Addison Wesley |
Auteur(s) | Joshua Bloch |
Parution | 15/07/2001 |
Nb. de pages | 252 |
Format | 18,5 x 23,4 |
Couverture | Broché |
Poids | 557g |
Intérieur | Noir et Blanc |
EAN13 | 9780201310054 |
Avantages Eyrolles.com
Consultez aussi
- Les meilleures ventes en Graphisme & Photo
- Les meilleures ventes en Informatique
- Les meilleures ventes en Construction
- Les meilleures ventes en Entreprise & Droit
- Les meilleures ventes en Sciences
- Les meilleures ventes en Littérature
- Les meilleures ventes en Arts & Loisirs
- Les meilleures ventes en Vie pratique
- Les meilleures ventes en Voyage et Tourisme
- Les meilleures ventes en BD et Jeunesse