Braindump
Design Patterns Overview
Overview of Design Patterns
This is a short overview of design patterns. It's based on my experience from working through the book Head First Design Patterns published by O'Reilly (a recommended reading?, by the way).
Summaries
Pattern | Summary | Example in the book |
---|---|---|
Abstract Factory | Allows a client to create a family of objects without relying on an implementation. | Ingredients factories |
Adapter | Provides a different interface for another object. | |
Command | A command object represents an order to be executed. | Remote control and its buttons |
Composite | Allows clients to use collections of objects in the same way as single objects. | The different menus in a restaurant |
Decorator | Extends the behaviour of an existing object with new behaviour. | Calculating the price of coffee specialities |
Facade | Provides a simplified interface for another object or set of corresponding objects. | Home cinema equipment |
Factory Method | Creating a concrete implementation is delegated to subclasses. | |
Iterator | Use a collection of objects without knowing the implementation of the collection. | |
Observer | The observed subject notifies registered clients about changes. | |
Proxy | Control access to another object. | |
Singleton | Ensure that only one instance of a class exists. | |
State | Change state based behaviour through delegation. | |
Strategy | Change behaviour through delegation. | Ducks' flying and quacking |
Template Method | Steps of an algorithm are implemented by subclasses. | Brewing coffee and tea |