Design Pattern - Singleton
The Singleton Design Pattern 1.1. Definition The singleton Pattern ensures a class has only one instance, and provides a global point of access to it. 1.2. Usage Singletons are useful to define classes which should only be available once, e.g. a model which is use in several view of an application, a logger or a device driver. An example is an application which reads the data from a file into another class A. This content should be available in the whole application. Therefore the class A is defined as a singleton. Another example would be the following View A and View B would like to display the same data of class with hold the data (model class). Using a singleton for the model class ensures that same data is used. 1.3. Code Example The possible implementation of Java depends on the version of Java you are using. As of Java 6 you can singletons with a single-element enum type. package mypackage...