USE THE SINGLETON PATTERN IN APPLICATIONS Applications often need a single source for services based on dynamic contexts at runtime. A JDBC connection pool, a user preferences manager, a window manager, etc., are all examples of objects that may need to be restricted to a single instance. The Singleton design pattern guarantees that one and only one instance of the desired class is present within a given JVM instance. While you can accomplish much of the same thing with static class methods and fields, that approach makes initialization and dynamic data management more difficult than it needs to be. The Singleton pattern takes care of all of these issues and can be set up quickly around any class. Here is the general pattern: public class Singleton { private static Singleton theSingleton; private Singleton() { //Do any initialization work here } public static Singleton get() { if(theSingleton == null) { theSingleton = new Singleton(); } return theSingleton; } // class-specific methods and fields can be added here... } The Singleton object's methods can then be referenced from other code by the phrase: Singleton.get().foo(); The code example dictates that the class is not instantiated until it is needed, which may not be appropriate for classes that have long initialization times. You can work around this by simply making sure that instantiation occurs during startup by calling the get() method at initialization time. This technique has the added advantage of providing an opportunity to catch any initialization exceptions thrown by your Singleton class. By basing classes on the Singleton pattern, you can create objects that provide global services to your applications and assure that only one instance of your class will be present at runtime. -------------------------------------------