Singleton Pattern



Intent 1

Ensure a class has only one instance, and provide a global point of access to it.

Why 1

Application needs one, and only one, instance of an object. Additionally, lazy initialization and global access are necessary.

Definition 2

Singleton pattern is a design pattern that restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system. The concept is sometimes generalized to systems that operate more efficiently when only one object exists, or that restrict the instantiation to a certain number of objects.


Example Code


Deeper Articles

Example in Real Libraries


One thought on “Singleton Pattern

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s