| Author |
Singleton described to a simpleton
|
Donald R. Cossitt
buckaroo
Ranch Hand
Joined: Jan 31, 2003
Posts: 401
|
|
I cannot find reference to 'singleton' in any manual I have currently (at least directly) and Google search gives C#, ASP, C++ and Delphi only (maybe they're the same?). Somebody point to an URL, book, give two bits...? TIA
|
doco
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
"Singleton" is a more or less language-independent design pattern, documented all over the place on the Web. Here's perhaps the definitive discussion from the seminal Portland Pattern Repository. Here's a reasonable Java interpretation.
|
[Jess in Action][AskingGoodQuestions]
|
 |
John Smith
Ranch Hand
Joined: Oct 08, 2001
Posts: 2937
|
|
Originally posted by Donald R. Cossitt: I cannot find reference to 'singleton' in any manual I have currently (at least directly) and Google search gives C#, ASP, C++ and Delphi only (maybe they're the same?). Somebody point to an URL, book, give two bits...? TIA
A Google query for "java singleton" returns 68,100 hits. JavaWorld (very good source) along has 111 articles about singletons.
|
 |
Vinod Venkatasubramanian
Greenhorn
Joined: Oct 19, 2003
Posts: 13
|
|
The book on Design Patterns by the Gang of 4 discusses this pattern. One nice real-world example in Windows is the "Run" dialog box (Start->Run)... how many ever times you click on 'Run', the same dialog box is returned, ie, the handle to the same window.
|
 |
Donald R. Cossitt
buckaroo
Ranch Hand
Joined: Jan 31, 2003
Posts: 401
|
|
Thanks Ernst, Eugene, Vinod. This was most helpful. Buy yourself a beer on me. :roll:
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
|
We also have an entry for Singleton in our FAQ: http://test.javaranch.com/wiki/view?SingletonPattern
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
 |
|
|
subject: Singleton described to a simpleton
|
|
|