In a software project where you need to ensure that only one instance of a database connection manager is used throughout the application, which design pattern would you employ?
- Decorator
- Factory Method
- Observer
- Singleton
The correct design pattern for ensuring a single instance of a class is the Singleton pattern. This pattern restricts the instantiation of a class to one object and provides a global point of access to that instance. It's commonly used for scenarios like managing database connections to maintain consistency across the application.
Loading...
Related Quiz
- Which of the following elements is used to create a hyperlink in HTML?
- What is the difference between adaptive design and responsive design?
- The command "git pull" is equivalent to "git fetch" followed by _______.
- In OOP, a class is a blueprint for creating _______.
- Which caching strategy is suitable for reducing database load and improving response times for frequently accessed data?