1.

Describe the singleton pattern.

Answer»

The singleton pattern is a software design pattern in software engineering that limits the instantiation of a class to one "single" instance. This is BENEFICIAL when only one item is required to coordinate system-wide actions. 

One of the most basic design patterns is the singleton. Sometimes we just NEED one instance of our class, such as a single DB connection SHARED by numerous objects, because making a separate DB connection for each object could be expensive. SIMILARLY, instead of developing many managers, an application might have a single configuration manager or error manager that handles all problems.



Discussion

No Comment Found