Qoders Blog     About     Archive     Feed
by Qadeer Ahmad Khan

Effective Java - Enums and Annotations

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

Effective Java - Generics

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

Effective Java - Classes and Interfaces

Classes and Interfaces (Ch 4) This is a short summary of Joshua Blochs book Effective Java chapter 4. I have only included items that I find relevant. Minimize accessibility to keep your API clean (item 13) A public class or member is part of the contract to your clients, and... View entire post

Effective Java - Methods Common to All Objects

Methods Common to All Objects (Ch 3) This is a short summary of Joshua Blochs book Effective Java chapter 3. I have only included items that I find relevant. The general equals() contract (item 8) The equals contract describes the equivalence relation as: x.equals(null) == false Reflexive - x.equals(x) ==... View entire post

Effective Java - Creating and Destroying Objects

Creating and Destroying Objects (Ch 2) This is a short summary of Joshua Blochs book Effective Java chapter 2. I have only included items that I find relevant. Static Factories (item 1) Some advantages of static factories vs constructors: Factory methods have names which add a description to the constructor... View entire post

Shell (unix) commands you always forget

This is a list of typical commands that I often have to Google because I forget either their usage or important flags. Using grep with perl type regex ls | grep -P "dirNo\d\d$" Using the -P flag lets you search for more advanced regex expressions. Other useful grep flags: -i... View entire post