Starting learning design patterns by reading book Design Patterns - Elements of Reusable Object-oriented Softerware. I think I have been seeing the design patterns a lot in my daily life and use them from time to time, like factory, iterator, but I never site down and go through all of them in an organized way.
I will put what I’ve learned here and today is the overview tables of all the patterns in the book.
There is a collection of good examples in Python, which could be founded here: python-patterns
| Purpose | Design Pattern | Scope | Aspects That Can Vary |
|---|---|---|---|
| Creational | Abstract Factory | Object | families of product objects |
| Builder | Object | how a composite objects gets created | |
| Factory Method | Class | subclass of objects that is instantiated | |
| Prototype | Object | class of object that is instantiated | |
| Singleton | Object | the solo instance of a object | |
| Structural | Adapter | Class/Object | interface to an object |
| Bridge | Object | implementation of an object | |
| Composite | Object | structure and composition of an object | |
| Decorator | Object | responsibilities of an object without subclassing | |
| Facade | Object | interface to a subsystem | |
| Flyweight | Object | storage costs of objects | |
| Proxy | Object | how an object is accessed; its location | |
| Behavioral | Chain of Responsibility | Object | object that can fulfill an request |
| Command | Object | when and how a request is fulfilled | |
| Interpreter | Class | grammar and interpretation of a language | |
| Iterator | Object | how an aggregate’s elements are accessed, traversed | |
| Mediator | Object | how and which objects interact with each other | |
| Memento | Object | what private information is stored outside an object, and when | |
| Observer | Object | number of objects that depend on another objects; how the dependent objects stay up to date | |
| State | Object | states of an object | |
| Strategy | Object | an algorithm | |
| Template Method | Class | steps of an algorithm | |
| Visitor | Object | operations that can be applied to objects without changing their classes |
