Structural Patterns Flashcards
What is the purpose of the ‘Adapter’ pattern?
Converts the interface of a class into another interface the client expect.
Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.
What is the purpose of the ‘Composite’ pattern?
Composes objects into tree structures to represent part-whole hierarchies.
Composite lets clients treat individual objects and compositions of objects uniformly.
What is the purpose of the ‘Decorator’ pattern?
Attaches additional responsibilities to an object dynamically.
Decorators provide a flexible alternative to subclassing for extending functionality.
What is the purpose of the ‘Facade’ pattern?
Provides a unified interface to a set of interfaces in a subsystem.
Facade defines a higher-level interface that makes the subsystem easier to use.
What is the purpose of the ‘Flyweight’ pattern?
Uses sharing to support large numbers of fine-grained objects efficiently.
What is the advantage of using a ‘Decorator’ pattern?
Decorators provide a flexible alternative to subclassing for extending functionality.
What is the advantage of using a ‘Composite’ pattern?
Composite lets clients treat individual objects and compositions of objects uniformly.
What is the advantage of using a ‘Facade’ pattern?
Facade defines a higher-level interface that makes the subsystem easier to use.
What is the advantage of using a ‘Adapter’ pattern?
Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.