Concurrency (Ch 10) This is a short summary of Joshua Blochs book Effective Java chapter 10. I have only included items that I find relevant. Synchronize access to shared mutable data (Item 66) Reading or writing a variable other than long or double is atomic, so why use synchronized? Synchronized...
View entire post
Exceptions (Ch 9) This is a short summary of Joshua Blochs book Effective Java chapter 9. I have only included items that I find relevant. Throw exceptions appropriate to the abstraction (Item 61) Higher layers should translate lower-level exceptions to their domain. Lower level exception may not make any sense...
View entire post
General Programming (Ch 8) This is a short summary of Joshua Blochs book Effective Java chapter 8. I have only included items that I find relevant. Avoid float and double if exact answers are required (Item 48) In binary floating point arithmetic floats and doubles cannot represent 0.1 or any...
View entire post
Methods (Ch 7) This is a short summary of Joshua Blochs book Effective Java chapter 7. I have only included items that I find relevant. Parameter validation (Item 38) Non-public methods should check their parameters using assertions (assert) because you as author control the circumstances under which the method are...
View entire post
Enums and Annotations (Ch 6) This is a short summary of Joshua Blochs book Effective Java chapter 6. I have only included items that I find relevant. Enum (Item 30) Use abstract methods in Enums to give each enum constant specific behaviour. Strategy enum pattern: delegate part of behaviour into...
View entire post
Generics (Ch 5) This is a short summary of Joshua Blochs book Effective Java chapter 5. I have only included items that I find relevant. Don’t use raw types (Item 23) Using unbounded wildcard type is better than using raw types e.g. Set<?>. This is because you cannot add anything...
View entire post