Singleton.
During application development process a developer in many cases needs to be sure that some class has only one (single) instantiated object during application lifecycle. In that way the singleton pattern is the standard solution.
Singleton is one of the easiest desgn pattern and the implementation is the obvious. The main trick in the singleton implementation is to hide the class constructor as the protected method as well as the method for class instantiation needs to be declared as the static. This way is one of the popular singleton pattern implementation methods.
|