Design Patterns ToC
Structural patterns

Help manage how classes organize


Allows you to encapsulate Requests as an object letting you parametrize clients with different requests. It is used in UI panels (actions).


Defines the grammar of a language and is able to interpret it. I.E the southest city given a set of them.


Mechanisk to access aggregated elements without exposing its representation (next/hasnext/remove).


It is an object that encapsulates how a set of objects interact. Promotes loos coupling by keeping objects from referencing each other.


It's a factory class, that allows creating multiple objects, buffering the ones you already created to avoid having to create them again ( a map).


Provides a place holder to control an access an object. This is useful if you don't want to modify the object itself. For instance, a very time consuming method can be run a thread of the proxy.

Behavioural patterns

Help manage what classes actually do

Chain of responsability

Each element of the chain does a small task of work and delegate to the next one.


Convert a given interface to another interface.


Separates abstraction from implementation so that they can vary independently.


Different objects that have to be dealt with.


Attach additional responsabilities to an object dynamically.


Higher level interface that groups a set of interfaces to facilitat client code's work.


Separate construction of complex object from its representation.


Interface for creating an object, let subclasses decide which one.


When creating new instances is expensive, you can extend clonable and use a single instance you can clone.


A class that has a single instance.

Creational Patterns

They facilitate creating other classes

Abstract factory

Creates families or related objects without specifying concrete classes.

Simple Factory

Delegating instantiation of objects to a specific class, useful when the creation of the object is complex (strategies/states/...).

Null Object

Specific dummy implementation of an interface, provides no behaviour, used to avoid having to check for actual null objects.

Curiously recurring generic pattern

A builder super class can hold a generic type, bounded to its type. Subclasses can pass its type so the builder methods within the super class return the correct subtype.

Class Builder<T extends Builder>
        T withFoo(foo)
            return (T) this;
    Class SubBuilder extends Builder<SubBuilder>
Concurrency Patterns

Facilitate dealing with threads

Double-checked locking

Reduces lock contention by testing the locking criterion withouth aquiring the lock, then if the testing is successful it is tested again after acquiring the lock.