Alex Rivera | Logout

Singleton pattern

Asked 2010-07-23T15:07:54.953
24

When should we use the Singleton pattern and why?

Edit
Report

1 Answer

6

If you have a situation when exactly one object is needed to coordinate actions across the system, then you can use this pattern. A good example of this is the Facade, that is, Facades can be implemented as singletons because often one Facade object is needed across the system.

But in general, it's usually a bad practice and should be avoided, one big reason is it greatly inhibits extensibility.

answered 2010-07-23T15:12:14.067

Your Answer