Creational

Java: Create Immutable Object using Builder Pattern

To create immutable Java object, we should use the Builder Pattern, as described in Effective Java. This is the pattern I normally used now for immutable class.

1: public class Person {
2: private final String name;
3: private final int […]

Singleton is a bad design pattern

I am not totally against Singleton design pattern. However, based on experience, normally if there is Singleton design pattern in your application, you should carefully study your code. Usually there is always a better way of doing it other than using Singleton design pattern.
Consider the following code snippet I encountered for one of the legacy […]

Design Pattern in Java 101 - Builder Pattern (Creational Pattern)

Download Source Code
Builder pattern is used to construct a complex object from simple objects step by step.
E.g.,
I have a Message class

public class Message {
private String sender;
private String recipient;
private String header;
private String body;

public String getSender() {
[…]