6. Design Pattern Questions Flashcards
What’s dependency injection?
Dependency injection is the ability to supply an external dependency into a component. It helps us develop loosely coupled code.
What are the three ways of implementing dependency injection?
- Constructor injection
- Property injection
- Method injection
Who are the gang of four?
The authors of the book Design Patterns: Elements of Reusable Object-Oriented Software
What are the three types of design patterns?
- Creational patterns
- Structural patterns
- Behavioral patterns
What is a creational pattern?
Ways to create objects while hiding the creation logic.
What is a structural pattern?
A design pattern that deals with class and object composition, and use inheritance to compose interfaces and objects for functionality.
What is a behavioural pattern?
Design patterns that are concerned with communication between objects.
What are the five creational design patterns?
- Abstract Factory
- Bulder
- Factory Method
- Prototype
- Singleton
What is the Abstract Factory pattern?
A creational design pattern that creates an instance of several families of classes.
What is the Builder pattern?
A creational design pattern that separates object construction from its representation.
What is the Factory Method pattern?
A creational design pattern that creates an instance of several derived classes.
What is the Prototype pattern?
A creational design pattern that produces a fully initialised instance to be copied or cloned.
What is the Singleton pattern?
A design pattern that produces a class of which only a single instance can exist.
What are seven structural design patterns?
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Flyweight
- Proxy
What is the Adapter pattern?
A structural design pattern that matches interfaces of different classes.