Design Patterns #

Strategy pattern #

An example in codename one

Composite pattern #

An example of the “wrong way to do things”

A refactored way:

Decorator pattern #

As a reminder, this is not the same as the composite pattern:

State pattern #

Pree’s metapatterns #
Concerning the state pattern vs the strategy pattern

Singleton pattern #

Note the synchronize keyword in the method header, this makes the method thread safe.
Factory pattern #

Abstract factory pattern #
