How are the Gang of Four patterns categorized?
Answer
The 23 GoF patterns are divided into three categories based on their purpose. Creational patterns (5) deal with object creation: Singleton, Factory Method, Abstract Factory, Builder, Prototype. Structural patterns (7) deal with composing classes and objects: Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy. Behavioral patterns (11) deal with communication and responsibility between objects: Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor. Creational patterns abstract the instantiation process; structural patterns assemble objects into larger structures; behavioral patterns define how objects cooperate to carry out complex tasks.
Previous
When should you NOT use design patterns?
Next
How are GoF patterns used in real-world frameworks?
More Design Patterns (Gang of Four) Questions
View all →- Intermediate What is the Template Method design pattern?
- Intermediate What is the Visitor design pattern?
- Intermediate What is the difference between Factory Method and Abstract Factory?
- Intermediate When should you NOT use design patterns?
- Intermediate How are GoF patterns used in real-world frameworks?