Definition:
The intent of Facade pattern is to ensure that a class has only one instance and to provide a global point of access to it.

What is:
Singleton pattern

Example:

1. Bob Tarr’s singleton pattern

2. Refactor your Java code-03 (lazy loaded singletons)

Bitter:

  • Singleton is probably the best known pattern, but it ‘s very easy to misuse. Don’t let Singletons become a fancy way to create a global variables. Minimize the number of classes that know they’re working with a Singleton; it’s better for classes to simply know that they have an object to work with, not the restrictions on its creation.
Advertisements