Home arrow C++ arrow C++ In Theory: The Singleton Pattern, Part 2
C++

C++ In Theory: The Singleton Pattern, Part 2


In our second article on the Singleton pattern, J. Nakamura discusses a reusable code version of the pattern.

Author Info:
By: J. Nakamura
Rating: 4 stars4 stars4 stars4 stars4 stars / 32
January 25, 2005
TABLE OF CONTENTS:
  1. · C++ In Theory: The Singleton Pattern, Part 2
  2. · Singleton Generalization
  3. · Testing Our Generic Implementation
  4. · Singletons are not for Simpletons

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
C++ In Theory: The Singleton Pattern, Part 2
(Page 1 of 4 )

In the previous article I introduced a design pattern named the “Singleton” as it is described in the book Design Patterns [Gamma]. Design patterns are very useful for describing solutions to common problems that software engineers often encounter. The Singleton pattern is a solution to the desire to have only one object of a class instantiated during the lifetime of your application.

Though design patterns were invented because solutions were often not reusable on the code level, the singleton pattern actually does have a reusable code version. We are going to look at a way to generalize the singleton implementation and how we can use the generalization to deal with construction/destruction sequence problems.

This topic will be covered in four sections:

  1. Singleton Generalization;

  2. Testing Our Generic Implementation;

  3. Singletons are not for Simpletons; and

  4. Resources.

Let's get started.


blog comments powered by Disqus
C++ ARTICLES

- Intel Threading Building Blocks
- Threading Building Blocks with C++
- Video Memory Programming in Text Mode
- More Tricks to Gain Speed in Programming Con...
- Easy and Efficient Programming for Contests
- Preparing For Programming Contests
- Programming Contests: Why Bother?
- Polymorphism in C++
- Overview of Virtual Functions
- Inheritance in C++
- Extending the Basic Streams in C++
- Using Stringstreams in C++
- Custom Stream Manipulation in C++
- General Stream Manipulation in C++
- Serialize Your Class into Streams in C++

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials