DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Singleton Classes

  1. #1
    Join Date
    Feb 2004
    Posts
    111

    Singleton Classes

    I've just been reading up on the concept of singleton classes and I'm curious to know what uses other programmers have found for this pattern. Personally, I'm working through the design of an application and I was considering using a singleton object to handle the database connections.

    Any input would be greatly appreciated.

    L -

  2. #2
    Join Date
    Feb 2007
    Posts
    35
    Getting the same database connection is one of the most common I did use singleton (though for particular needs, I sometimes don't use singleton, but it's rare since it's more troublesome to manage).
    Logging/tracing (if you make your own) is another I could think of (though recently I always use log4j or its derivation and never tried to write my own anymore). Honestly, I haven't seen the log4j code, but I guess it's using singleton.

  3. #3
    Join Date
    Feb 2004
    Posts
    111
    Thanks for the reply. I've been studying the different design patterns because of the projects architectures that I'm designing for the job.

    L -

Similar Threads

  1. Loading classes at runtime
    By Shayne in forum Java
    Replies: 3
    Last Post: 05-12-2007, 08:15 AM
  2. Singleton
    By ami in forum C++
    Replies: 10
    Last Post: 01-22-2007, 09:13 AM
  3. Java Singleton Pattern Tutorial
    By hemanthjava in forum Java
    Replies: 2
    Last Post: 11-14-2006, 11:57 PM
  4. Gradebook program
    By [gx]Shadow in forum Java
    Replies: 5
    Last Post: 10-25-2006, 10:20 PM
  5. java classes in windows and linux
    By DaveMere in forum Java
    Replies: 2
    Last Post: 08-09-2005, 01:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center