What are the 3 categories of design patterns?
What are creational design patterns?
Creational design patterns are patterns that control how objects are created
What are structural design patterns?
Creational design patterns are patterns that are concerned with how classes and objects can be composed, to form larger structures.
What are behavioural design patterns?
Behavioural patterns are common patterns for facilitating elegant communication between objects.
What are examples of creational design patterns?
What are examples of structural design patterns?
What are examples of behavioural design patterns?
What is the Observer design pattern?
Observer is a behavioural design pattern that lets you define a subscription mechanism to notify multiple objects about any events that happen to the object they’re observing.
Also known as: Event-Subscriber, Listener
An Observer (usually inherited from an abstract base class) keeps a list of subscribers, which are notified on changes. The subscribers itself also inherit from an abstract base class together with the update() method.
What is the Adapter design pattern?
Adapter is a structural design pattern that allows objects with incompatible interfaces to collaborate.
Also known as: Wrapper
Use the Adapter class when you want to use some existing class, but its interface isn’t compatible with the rest of your code. The Adapter pattern lets you create a middle-layer class that serves as a translator between your code and a legacy class, a 3rd-party class or any other class with a weird interface.