InterviewSolution
| 1. |
Can you please briefly describe the singleton design pattern in brief? |
|
Answer» The singleton pattern is a software engineering design pattern that RESTRICTS a class's instantiation to one "single" instance. When only one object is NECESSARY to COORDINATE system-wide actions, this is advantageous. The singleton is one of the most fundamental design patterns. Because creating a separate DB connection for each object could be expensive, we sometimes just REQUIRE one instance of our class, such as a single DB connection shared by multiple instances. Similarly, RATHER than building several managers, an application may have a single configuration or error manager that handles all issues. |
|