Summary

We'll cover the following...

Summary

PatternPurpose

Builder Pattern

The builder pattern is used to create objects. It seperates out how the object is represented and how it is created. Additionally, it breaks down the creation into multiple steps. For instance in Java the java.lang.StringBuilder is an example of the builder pattern.

Singleton Pattern

The singleton pattern is applied to restrict instantiation of a class to only one instance. For instance in the Java language the class java.lang.Runtime is a singleton.

Prototype Pattern

Prototype pattern involves creating new objects by copying existing objects. The object whose copies are made is called the prototype. In Java the clone() method of java.lang.Object is an example of this pattern.

Factory Method Pattern

The factory method is defined as providing an interface for object creation but delegating the actual instantiation of objects to subclasses. For instance the method getInstance() of the class java.util.Calendar is an example of a factory method pattern.

Abstract Factory

The abstract factory pattern is defined as defining an interface to create families of related or dependent objects without specifying their concrete classes.The abstract factory is particularly useful for frameworks and toolkits that work on different operating systems. For instance, if your library provides fancy ...