C++
  Home arrow C++ arrow C++ In Theory: The Singleton Pattern, Part...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C++

C++ In Theory: The Singleton Pattern, Part 2
By: J. Nakamura
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 29
    2005-01-25

    Table of Contents:
  • C++ In Theory: The Singleton Pattern, Part 2
  • Singleton Generalization
  • Testing Our Generic Implementation
  • Singletons are not for Simpletons

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


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


    (Page 1 of 4 )

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

    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.

    More C++ Articles
    More By J. Nakamura


       · Very nice. But one question from dummy-programmer: what, if my class has a...
       · If you want your singleton to use parameters in its construction, for example...
       · A good introduction, but for the serious more advanced programmer, you can introduce...
     

    C++ ARTICLES

    - 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++
    - Advanced File Handling with Streams in C++
    - File Handling and Streams in C++
    - The STL String Class
    - Iostream Library and Basic I/O in C++
    - Introduction to Streams







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT