Working solutions to programming challenges faced by Java developers on a daily basis, revealing what to do to produce clear, robust and efficient code. Include rules in short essay form, and the author's 'war stories,' giving advice and insights into nuances of the language.
Topics covered:
* Best practices and tips for Java
* Creating and destroying objects (static factory methods, singletons, avoiding duplicate objects and finalizers)
* Required methods for custom classes (overriding equals(), hashCode(), toString(), clone(), and compareTo() properly)
* Hints for class and interface design (minimizing class and member accessibility, immutability, composition versus inheritance, interfaces versus abstract classes, preventing subclassing, static versus nonstatic classes)
* C constructs in Java (structures, unions, enumerated types, and function pointers in Java)
* Tips for designing methods (parameter validation, defensive copies, method signatures, method overloading, zero-length arrays, hints for Javadoc comments)
* General programming advice (local variable scope, using Java API libraries, avoiding float and double for exact comparisons, when to avoid strings, string concatenation, interfaces and reflection, avoid native methods, optimizing hints, naming conventions)
* Programming with exceptions (checked versus run-time exceptions, standard exceptions, documenting exceptions, failure-capture information, failure atomicity)
* Threading and multitasking (synchronization and scheduling hints, thread safety, avoiding thread groups)
* Serialization (when to implement Serializable, the readObject(), and readResolve() methods)
0 comments
Post a Comment