Implementing the Singleton Pattern

Instead of reinventing a solution all you have to do is learn the pattern and know when to apply it. CodeGuru.com's Paul Kimmel touches on the Singleton pattern and its use.

provided by: 
Originally published at Internet.com


Before you can be expected to get excited about patterns it will be helpful to tell you what they are and why you want to know about them.

Patterns are named solutions or strategies to problems that have already been solved. Patterns have names and descriptions that describe how to implement a particular pattern, and usually there is information that describes the benefits and consequences of using a specific pattern. Most importantly is that patterns are solutions to often sticky problems that someone with a substantial amount of experience has already solved in a clever way. If you know about the pattern then you can simply borrow. Knowing about patterns is what it would be like if Michael Jordan were able to tell you how to leap and all you had to do were follow his instructions. Unfortunately physical emulation takes a substantial amount of work and natural ability. Mental emulation requires a lot of effort, too, but perhaps less natural ability.

A pattern is a general solution to a category of problem. Instead of reinventing a solution all you have to do is learn the pattern and know when to apply it. Some patterns are easier to understand and use than others.

The pattern we are going to look at is the Singleton pattern. I actually learned to use it years ago before it was called a pattern. Ten years ago or so, using Singleton objects was just referred to as Singletons. (I originally read about this pattern in a book by James Coplien, "Advanced C++", or maybe it was one of Grady Booch's books. It is long enough ago that I forgot the source, but the pattern is useful enough that I use it all the time.)

What is the Singleton pattern?

...

Read article at Internet.com site
Regional Articles
- Implementing the Singleton Pattern Alabama
- Implementing the Singleton Pattern Alaska
- Implementing the Singleton Pattern Arizona
- Implementing the Singleton Pattern Arkansas
- Implementing the Singleton Pattern California
- Implementing the Singleton Pattern Colorado
- Implementing the Singleton Pattern Connecticut
- Implementing the Singleton Pattern DC
- Implementing the Singleton Pattern Delaware
- Implementing the Singleton Pattern Florida
- Implementing the Singleton Pattern Georgia
- Implementing the Singleton Pattern Hawaii
- Implementing the Singleton Pattern Idaho
- Implementing the Singleton Pattern Illinois
- Implementing the Singleton Pattern Indiana
- Implementing the Singleton Pattern Iowa
- Implementing the Singleton Pattern Kansas
- Implementing the Singleton Pattern Kentucky
- Implementing the Singleton Pattern Louisiana
- Implementing the Singleton Pattern Maine
- Implementing the Singleton Pattern Maryland
- Implementing the Singleton Pattern Massachusetts
- Implementing the Singleton Pattern Michigan
- Implementing the Singleton Pattern Minnesota
- Implementing the Singleton Pattern Mississippi
- Implementing the Singleton Pattern Missouri
- Implementing the Singleton Pattern Montana
- Implementing the Singleton Pattern Nebraska
- Implementing the Singleton Pattern Nevada
- Implementing the Singleton Pattern New Hampshire
- Implementing the Singleton Pattern New Jersey
- Implementing the Singleton Pattern New Mexico
- Implementing the Singleton Pattern New York
- Implementing the Singleton Pattern North Carolina
- Implementing the Singleton Pattern North Dakota
- Implementing the Singleton Pattern Ohio
- Implementing the Singleton Pattern Oklahoma
- Implementing the Singleton Pattern Oregon
- Implementing the Singleton Pattern Pennsylvania
- Implementing the Singleton Pattern Rhode Island
- Implementing the Singleton Pattern South Carolina
- Implementing the Singleton Pattern South Dakota
- Implementing the Singleton Pattern Tennessee
- Implementing the Singleton Pattern Texas
- Implementing the Singleton Pattern Utah
- Implementing the Singleton Pattern Vermont
- Implementing the Singleton Pattern Virginia
- Implementing the Singleton Pattern Washington
- Implementing the Singleton Pattern West Virginia
- Implementing the Singleton Pattern Wisconsin
- Implementing the Singleton Pattern Wyoming

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML