The Decorator Pattern

The decorator pattern is one of the classic structural patterns. A decorator wraps an existing object and provides additional functionality (decoration) whilst providing the same interface as the original object. One example which comes to mind is from an episode of Flight of the Conchords. Bret tries to ‘upgrade’ an ordinary mobile phone by gluing … Read more

The Builder Pattern

In this post we will discuss the Builder Pattern. This is one of the standard creational design patterns. It is particularly relevant when dealing with complex objects which may be conceptually built up from a set of components. In this pattern, the object is often built up in stages rather than being created immediately in … Read more