It is not easy to remember all design patterns. Here are some stories about design patterns which might help!
Creational
- Singleton – Only one president in America
- Factory – A factory that produces human
- Abstract Factory – An abstract factory to produce CPUs
- Builder – Build a drink
- Prototype – Create a lot of similar objects
Structural
- Adapter – Adapt an orange to an apple
- Bridge – Bridge your remote control to a TV
- Composite -Build a tree
- Decorator – Decorate your girlfriend
- Facade – Perform a complex task using simple interface
- Flyweight – Create less and serve more
- Proxy – Use proxy to get do bad things
- MVC – Module, View and Controller in Strut 2
Behavioral
- Observer – Look for a job or observe a job?
- Observer – A simple Swing GUI example
- State – Work hard when life is hard
- Strategy – Will you get a ticket if speeding
- Template – Test a vehicle
- Visitor – Visit New York City
- Chain of responsibility – The responsibility chain
- Command – Use different command to control computer
- Interpreter – Interpret some context
- Iterator – Iterate a collection of objects
- Mediator – Mediate two colleagues
- Memento – Use memento to time travel
Design Patterns in Real Frameworks