Summary of the Applications of Design Patterns
Explore how to efficiently select and apply design patterns to various software development challenges. This lesson helps you understand which patterns fit common problems, from object creation and cloning to improving communication between objects, enabling you to enhance your code's adaptability and maintainability.
We'll cover the following...
This lesson summarizes which design patterns can be used to solve what specific type of software development problem. It’s intended to be a reference guide to help us find the right design pattern quickly.
Problems solved by design patterns
All problem categories that we’ve discussed in this section are listed here. For each one of them, all suitable design patterns are provided. If there are multiple design patterns that can solve a problem of a particular type, a one-sentence summary is provided next to each to help us decide which of them is more suitable for our specific situation.
-
When we don’t know what object implementations we’ll need ahead of time:
- Factory Method—If an object needs to be instantiated in one go.
- Abstract Factory—If multiple objects need to be instantiated in one go.
- Builder—If an object needs to be built step by step.
-
When we’re making several exact copies of a complex object:
- Prototype—It was specifically invented for easy cloning of objects.