Quiz: Design Patterns
Test your knowledge of design patterns.
We'll cover the following...
We need to create multiple resources that are very similar but complex to initialize every time.
Singleton pattern
We need to create instances of a type that have common and predictable features and functionalities but with slight variations.
Object pool
We need to create a resource once and then use it throughout our application.
Prototype pattern
We need to control the number of resources of the same nature that we spend on a particular activity.
Factory pattern
Low-level design scenario
Let us walk through a thought exercise similar to what we might encounter while doing the low-level design of a back-end application.
Let us say we want to connect a service to a database. We know our data is stored in MongoDB, and we need to write code to integrate with it and perform CRUD operations.
Setup
Setup
What would be the first thing you would set up in this situation? Which design pattern(s) would you use, if any?