Easy Design

All About Design

J2ee Design Patterns Singleton

without comments

what is the use of SingleTon Design pattern?

java,j2ee

Singleton is probably the most widely used design pattern. Its intent is to ensure that a class has only one instance, and to provide a global point of access to it. There are many situations in which a singleton object is necessary: a GUI application must have a single mouse, an active modem needs one and only one telephone line, an operating system can only have one window manager, and a PC is connected to a single keyboard. I will show how to implement the singleton pattern in C++ and explain how you can optimize its design for single-threaded applications.

class Singleton
{
public:
static Singleton* Instance();
protected:
Singleton();
Singleton(const Singleton&);
Singleton& operator= (const Singleton&);
private:
static Singleton* pinstance;
};

n so on n on

Google I/O 2009 – Best Practices for Architecting GWT App


Written by admin

October 26th, 2010 at 12:28 pm

Leave a Reply